草庐IT

DbContextOptions

全部标签

c# - 在 Startup.cs 中添加 DbContextOptions 而不是注册数据存储

我的问题是下面的代码在启动期间没有注册数据存储。这是我从应用程序的响应中得到的特定“错误”声明:Anunhandledexceptionoccurredwhileprocessingtherequest.InvalidOperationException:Nodatastoresareconfigured.ConfigureadatastorebyoverridingOnConfiguringinyourDbContextclassorintheAddDbContextmethodwhensettingupservices.Microsoft.Data.Entity.Storage.D

c# - 在 DbContextOptions 上找不到 UseMysql 方法

我在linux上玩弄dotnet核心,我正在尝试使用连接字符串配置我的DbContext到mysql服务器。我的DbContext看起来像这样:usingMicrosoft.EntityFrameworkCore;usingModels.Entities;namespaceModels{publicclassSomeContext:DbContext{//alotofdbSets...publicDbSetSomeDbSet{get;set;}publicSomeContext(DbContextOptionsoptions):base(options){}protectedoverr