我正在尝试使用Entity Framework使.NET Core 2.0控制台应用程序与MySQL数据库一起工作。
我已经尝试了Oracle(https://www.nuget.org/packages/MySql.Data.EntityFrameworkCore/)和Pomelo(https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql)连接器,并且它们都抛出了TypeLoadException:
Oracle例外:
tdsum[ntr] = element.childElementCount;
柚子例外:
System.TypeLoadException occurred
HResult=0x80131522
Message=Method 'Clone' in type 'MySQL.Data.EntityFrameworkCore.Infraestructure.Internal.MySQLOptionsExtension' from assembly 'MySql.Data.EntityFrameworkCore, Version=8.0.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
Source=<Cannot evaluate the exception source>
StackTrace:
at MySQL.Data.EntityFrameworkCore.Extensions.MySQLDbContextOptionsExtensions.UseMySQL(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 MySQLOptionsAction)
at Common.DAL.MyContext.OnConfiguring(DbContextOptionsBuilder optionsBuilder) in Program.cs:line 18
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_Model()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityType()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.get_EntityQueryable()
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
...