更新到EF 7.0.0-rc1-final打破了SQL DbContextOptionsBuilder UseSqlServer

And*_*ntt 5 c# sql-server entity-framework entity-framework-core asp.net-core

我刚刚从之前的EF 7版本更新了我的nuget包到EF 7.0.0-rc1-final,它破坏了我的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");
}
Run Code Online (Sandbox Code Playgroud)

错误:

Type'DbContextOptionsBuilder'在未引用的程序集中定义.您必须添加对程序集'EntityFramework.Core,Version 7.0.0.0'的引用

我已经将EntityFramework.Core安装到NuGet中的最新版本,但我似乎无法用'using'来引用它.这只是在更新到rc1-final时发生的,我找不到任何引用该更改的文档.

project.JSON

{
  "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"
  ]
}
Run Code Online (Sandbox Code Playgroud)

SRQ*_*der 14

我相信这个名字也改变了:

'EntityFramework.SqlServer':"7.0.0-rc1-final"

- 就是现在:

'EntityFramework.MicrosoftSqlServer':"7.0.0-rc1-final"

请参阅post:将ASP.NET 5 Beta 8升级到RC1

提示:从GitHub下载Asp.Net文档,看看它们(ASP.NET作者)如何编写引用和依赖项...

  • 我有beta和rc1,并删除了帮助 (3认同)

Joe*_*tte 1

您需要将所有内容更新为 rc1

"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"EntityFramework.SqlServer": "7.0.0-rc1-final",
"EntityFramework.SqlServer.Design": "7.0.0-rc1-final",
"EntityFramework.Commands": "7.0.0-rc1-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
"Newtonsoft.Json": "8.0.1-beta2",
"EntityFramework.Core": "7.0.0-rc1-final"
Run Code Online (Sandbox Code Playgroud)

我还怀疑您在 dnx451 下的依赖关系以及这些依赖关系是否合法或需要