linq2db / linq2db.EntityFrameworkCore

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

Integration with EF Core 3.1 and Pomelo Provider failed #61

Closed ronnypmuliawan closed 4 years ago

ronnypmuliawan commented 4 years ago

Hi,

I am testing out this package for the integration between EF Core and linq2db, but can't seem to get it working.

I have attached my test project below.

        [HttpGet]
        public async Task<IActionResult> Test3()
        {
            LinqToDBForEFTools.Initialize();
            // testing simple linq2db
            var students = await _context.Students.ToLinqToDBTable().ToListAsync();
            return Json(students);
        }

On my sample method above in HomeController.cs, I am expecting the above to yield the student listing to me via linq2db. But I got this exception instead. TypeLoadException: Could not load type 'MySqlConnector.MySqlConnection' from assembly 'MySqlConnector, Version=0.69.9.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92'. System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, string name, bool throwOnError, bool ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext) System.Reflection.RuntimeAssembly.GetType(string name, bool throwOnError, bool ignoreCase) System.Reflection.Assembly.GetType(string name, bool throwOnError) LinqToDB.DataProvider.MySql.MySqlProviderAdapter+MySqlConnector.CreateAdapter() LinqToDB.DataProvider.MySql.MySqlProviderAdapter.GetInstance(string name) LinqToDB.DataProvider.MySql.MySqlDataProvider..ctor(string name, MappingSchema mappingSchema) LinqToDB.DataProvider.MySql.MySqlDataProvider..ctor(string name) LinqToDB.EntityFrameworkCore.LinqToDBForEFToolsImplDefault.CreateLinqToDbDataProvider(EFProviderInfo providerInfo, LinqToDBProviderInfo provInfo, EFConnectionInfo connectionInfo) LinqToDB.EntityFrameworkCore.LinqToDBForEFToolsImplDefault+<>c__DisplayClass4_0.<GetDataProvider>b__0(ProviderKey k) System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.GetOrAdd(TKey key, Func<TKey, TValue> valueFactory) LinqToDB.EntityFrameworkCore.LinqToDBForEFToolsImplDefault.GetDataProvider(EFProviderInfo providerInfo, EFConnectionInfo connectionInfo) LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.GetDataProvider(EFProviderInfo info, EFConnectionInfo connectionInfo) LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.CreateLinqToDbContext(DbContext context, IDbContextTransaction transaction) LinqToDB.EntityFrameworkCore.LinqToDBForEFTools.ToLinqToDBTable<T>(DbSet<T> dbSet)

Am i missing something? Or does it seem like there's a fundamental difference in MySqlConnector version used? Latest Pomelo release as of the reporting of this issue does not support 1.0 and above, but it seems like this package assumes MySqlConnector v1.0 and above.

NetCore31WebApp.zip

sdanyliv commented 4 years ago

We have found this issue also. It should be fixed after 3.1.2 relase which is planned on this Thursday https://github.com/linq2db/linq2db/pull/2454

ronnypmuliawan commented 4 years ago

@sdanyliv thanks for the quick response. Will give linq2db another try then.

sdanyliv commented 4 years ago

Note that It will be release 3.6.0 of EF Core integration.

sdanyliv commented 4 years ago

Release 3.6.0 is ready.