C# 升级到AspNet 5 RC1-update1后对SqlServerDbContextOptionsBuilder的调用不明确
我想将我的项目从asp.net beta-7升级到asp.net 5 RC1-update-1,但在我的C# 升级到AspNet 5 RC1-update1后对SqlServerDbContextOptionsBuilder的调用不明确,c#,asp.net,entity-framework,C#,Asp.net,Entity Framework,我想将我的项目从asp.net beta-7升级到asp.net 5 RC1-update-1,但在我的startup.cs中出现了两个错误: public void ConfigureServices(IServiceCollection services) { // Add Entity Framework services to the services container. services.AddEntityFramework() .AddSqlSe
startup.cs
中出现了两个错误:
public void ConfigureServices(IServiceCollection services)
{
// Add Entity Framework services to the services container.
services.AddEntityFramework()
.AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));
}
My project.json:
{
"webroot": "wwwroot",
"userSecretsId": "--removed--",
"version": "1.0.0-*",
"dependencies": {
"EntityFramework.Core": "7.0.0-rc1-final",
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
"EntityFramework.SqlServer": "7.0.0-beta7",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}
在jour
project.json
中似乎有一个重复的条目,尽管由于dll名称发生了更改,这并不明显:
以前的“EntityFramework.SqlServer”现在是:“EntityFramework.MicrosoftSqlServer”
所以只要把线去掉就行了
"EntityFramework.SqlServer": "7.0.0-beta7",
你应该准备好了。你可以分享你的project.json吗?当然可以,用我的project.json查看我的更新答案。仅供参考,我已删除userSecretsId
"EntityFramework.SqlServer": "7.0.0-beta7",