linq2db / linq2db.EntityFrameworkCore

Bring power of Linq To DB to Entity Framework Core projects
MIT License
449 stars 39 forks source link

Support for .NET 8 (RC1) #346

Closed warappa closed 9 months ago

warappa commented 10 months ago

Issue

When I upgrade to .NET 8 RC 1 (including Entity Framework Core), I get a MissingMethodException for System.Collections.Generic.IEnumerable1<Microsoft.EntityFrameworkCore.Metadata.IProperty> Microsoft.EntityFrameworkCore.Metadata.IEntityType.GetProperties(). This is because it was moved to ITypeBase (parent of IEntityType). https://github.com/dotnet/efcore/blob/77a996f6403526d879e111421e40f72ad26d696b/src/EFCore/Metadata/ITypeBase.cs#L113-L114

Expectation Hope

I know that EF Core 8 is still RC, but could you check if a version of Linq2db compiled against 8 RC1 is feasible?

Exception

System.MissingMethodException : Method not found: 'System.Collections.Generic.IEnumerable`1<Microsoft.EntityFrameworkCore.Metadata.IProperty> Microsoft.EntityFrameworkCore.Metadata.IEntityType.GetProperties()'.

<>c.<DefineConvertors>b__14_0(IEntityType e)
SelectManySingleSelectorIterator`2.MoveNext()
HashSet`1.UnionWith(IEnumerable`1 other)
HashSet`1.ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
DistinctIterator`1.ToArray()
LinqToDBForEFToolsImplDefault.DefineConvertors(MappingSchema mappingSchema, IModel model, IValueConverterSelector convertorSelector, DataOptions dataOptions)
LinqToDBForEFToolsImplDefault.CreateMappingSchema(IModel model, IMetadataReader metadataReader, IValueConverterSelector convertorSelector, DataOptions dataOptions)
<>c__DisplayClass17_0.<GetMappingSchema>b__0(ICacheEntry e)
CacheExtensions.GetOrCreate[TItem](IMemoryCache cache, Object key, Func`2 factory)
LinqToDBForEFToolsImplDefault.GetMappingSchema(IModel model, IMetadataReader metadataReader, IValueConverterSelector convertorSelector, DataOptions dataOptions)
LinqToDBForEFTools.GetMappingSchema(IModel model, IInfrastructure`1 accessor, DataOptions dataOptions)
LinqToDBForEFTools.CreateLinqToDBConnection(DbContext context, IDbContextTransaction transaction)
...
warappa commented 10 months ago

A quick and dirty experiment showed that at least SQLite and SQL Server had a handful failed tests, so no "quick" recompile.

MaceWindu commented 9 months ago

We plan to release new version by the end of this week and include .NET 8 version too

hjrb commented 9 months ago

We plan to release new version by the end of this week and include .NET 8 version too

Great!

MaceWindu commented 9 months ago

Looks like it will take couple of days more. We currently test postgresql, mysql, sqlite and sqlserver providers and only sqlserver one works and we need time to figure out if we can find any workarounds

hjrb commented 9 months ago

Looks like it will take couple of days more. We currently test postgresql, mysql, sqlite and sqlserver providers and only sqlserver one works and we need time to figure out if we can find any workarounds

Thanks for the update. Take your time. I am not in a hurry at all. I am using SQL Server. So if you want me to test something tell me how I can help.