注册

efcore8.0使用dm8报错

就知道吃 2024/01/23 694 2

【DM版本】: DM Database Server 64 V8
【操作系统】:CentOS 8.2.2004
【CPU】: Intel(R) Xeon(R) Gold 6278C CPU @ 2.60GHz
【问题描述】*:efcore 8.0 使用安装目录下的 dirvers\Microsoft.EntityFrameworkCore.Dm 连接数据库报错

//[Error] System.MissingMethodException: Method not found: 'Void CoreTypeMappingParameters..ctor(System.Type, Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer, System.Func`3<Microsoft.EntityFrameworkCore.Metadata.IProperty,Microsoft.EntityFrameworkCore.Metadata.IEntityType,Microsoft.EntityFrameworkCore.ValueGeneration.ValueGenerator>)'. at Microsoft.EntityFrameworkCore.Dm.Storage.Internal.DmByteArrayTypeMapping..ctor(String storeType, Nullable`1 dbType, Nullable`1 size, Boolean fixedLength, ValueComparer comparer, Nullable`1 storeTypePostfix) at Microsoft.EntityFrameworkCore.Dm.Storage.Internal.DmTypeMappingSource..ctor(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies) at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

测试代码

// Demo.cs public class Demo { public string Key { get; set; } = default!; public string? Value { get; set; } public string? Description { get; set; } } // DemoDbContext.cs public class DemoDbContext:DbContext { public DemoDbContext(DbContextOptions&lt;DemoDbContext> options) : base(options) { } public DbSet<Demo> AppSettings { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Demo>(x => { x.ToTable("AppSettings"); x.HasKey(p => p.Key); }); base.OnModelCreating(modelBuilder); } } // Program.cs var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext&lt;DemoDbContext>(db => { db.UseDm("Server=127.0.0.1:30236;UserID=***;PWD=********;"); }); var app = builder.Build(); app.MapGet("demo", async (DemoDbContext dbContext) =>{ var rows =await dbContext.AppSettings.ToArrayAsync(); // 调用报错 return rows; });
回答 0
暂无回答
扫一扫
联系客服