我刚刚将我的nuget包更新到EF 7.0.0-rc1-final版本,从之前的EF 7版本。这个更新破坏了我的SQL连接字符串代码。
using System.Collections.Generic;
using ComicEndpoints.Models;
using System.Threading.Tasks;
using Microsoft.Data.Entity;
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlServer(@"ConnectionString");
}
错误信息:
我已经在NuGet中安装了最新版本的EntityFramework.Core,但是在使用'using'时无法引用它。这个问题只发生在我升级到rc1-final之后,我无法找到任何文档涉及这种变化。 project.JSON类型 'DbContextOptionsBuilder' 是在一个未被引用的程序集中定义的。 您必须添加对程序集 'EntityFramework.Core, Version 7.0.0.0' 的引用。
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"EntityFramework.SqlServer": "7.0.0-beta8",
"EntityFramework.SqlServer.Design": "7.0.0-beta8",
"EntityFramework.Commands": "7.0.0-rc1-final",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
"Newtonsoft.Json": "8.0.1-beta2",
"EntityFramework.Core": "7.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNet.WebApi.Cors": "5.2.3",
"Microsoft.Owin.Cors": "3.0.1"
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}