【发布时间】:2019-09-30 15:37:03
【问题描述】:
如何在我想要的 ASP.NET Core 2.0 中获取 DbContext 的实例? 为了连接数据库,我使用了服务
string connection = Configuration.GetConnectionString("DefaultConnection");
services.AddDbContext<MobileContext>(options => options.UseSqlServer(connection));
【问题讨论】:
标签: c# entity-framework asp.net-core dependency-injection