MVC脚手架不支持实体框架6或更高版本 [英] MVC scaffolding does not support Entity Framework 6 or later

查看:478
本文介绍了MVC脚手架不支持实体框架6或更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刚刚升级到实体框架6看一看。我使用MVC4。

但是我收到试图使从模型和上下文控制器时,此消息。


  

MVC脚手架不支持实体框架6或更高版本。



解决方案

认为,这可以使用一些扩大:)如上ASP.NET MVC 4脚手架提到的不支持EF6或更高。这意味着一个较旧的EF,与MVC 4兼容将不得不被安装。要做到这一点:


  1. 打开包管理器控制台:

    • 选择工具 - >库包管理器 - >程序包管理器控制台


  2. 在程序包管理器控制台中,通过执行以下命令卸载当前EF包:

    卸载封装的EntityFramework -Version<版本号>

    *其中<版本号> 是当前安装的EF的版本号。结果
    *注意:找出EF版本安装的是什么,在运行程序包管理器控制台执行以下命令:

    获取封装的EntityFramework


  3. 要避免潜在问题的元数据在Web.config文件中的供应商项将需要删除:


    • 打开在项目目录的Web.config文件。

    • 删除以下行:

      <供应商>
          <供应商invariantName = System.Data.SqlClient的键入= System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer />
      < /供应商>



  4. 现在,在包管理器控制台执行以下命令来安装实体框架5.0.0:

    安装封装的EntityFramework -Version 5.0.0


Just upgraded to Entity Framework 6 to take a look. I'm using MVC4.

But i recieve this message when trying to make a controller from a model and context.

MVC scaffolding does not support Entity Framework 6 or later

解决方案

Thought this could use some expanding :) As mentioned above ASP.NET MVC 4 scaffolding does not support EF6 or higher. This means that an older EF, compatible with MVC 4 will have to be installed. To do this:

  1. Open the Package Manager Console:
    • select TOOLS -> Library Package Manager -> Package Manager Console
  2. In the Package Manager Console, uninstall the current EF package by executing the following command:

    UnInstall-Package EntityFramework -Version <version number>

    *Where <version number> is the version number of the EF currently installed.
    *NOTE: to find out what EF version is installed, run the following command in the Package Manager Console:

    Get-Package EntityFramework

  3. To avoid potential metadata problems the providers entry in the Web.config file will need to be removed:

    • Open the Web.config file in the project directory.
    • Delete the following lines:

      <providers> <provider invariantName=System.Data.SqlClient type=System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer /> </providers>

  4. Now, in the Package Manager Console Execute the following command to install Entity Framework 5.0.0:

    Install-Package EntityFramework -Version 5.0.0

这篇关于MVC脚手架不支持实体框架6或更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆