Entity Framework读取数据库连接字符串的代码如下:
public void ConfigureServices(IServiceCollection services) { services.AddEntityFramework() .AddSqlServer() .AddDbContext<EfDbContext>(options => { options.UseSqlServer(Configuration.Get("Data:ConnectionString")); }); }
之前是可以正常读取的,升级到 ASP.NET 5 RC1 + EF RC1 之后,运行时出现下面的错误:
public void ConfigureServices(IServiceCollection services) { services.AddEntityFramework() .AddSqlServer() .AddDbContext<EfDbContext>(options => { options.UseSqlServer(Configuration.Get("Data:ConnectionString")); }); }