MVC脚手架不支持实体框架6或更高版本 [英] MVC scaffolding does not support Entity Framework 6 or later
问题描述
刚刚升级到实体框架6看一看。我使用MVC4。
但是我收到试图使从模型和上下文控制器时,此消息。
MVC脚手架不支持实体框架6或更高版本。
块引用>解决方案认为,这可以使用一些扩大:)如上ASP.NET MVC 4脚手架提到的不支持EF6或更高。这意味着一个较旧的EF,与MVC 4兼容将不得不被安装。要做到这一点:
- 打开包管理器控制台:
- 选择工具 - >库包管理器 - >程序包管理器控制台
在程序包管理器控制台中,通过执行以下命令卸载当前EF包:
卸载封装的EntityFramework -Version<版本号>
*其中
<版本号>
是当前安装的EF的版本号。结果
*注意:找出EF版本安装的是什么,在运行程序包管理器控制台执行以下命令:
获取封装的EntityFramework
要避免潜在问题的元数据在Web.config文件中的供应商项将需要删除:
- 打开在项目目录的Web.config文件。
删除以下行:
<供应商>
<供应商invariantName = System.Data.SqlClient的键入= System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer />
< /供应商>现在,在包管理器控制台执行以下命令来安装实体框架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:
- Open the Package Manager Console:
- select TOOLS -> Library Package Manager -> Package Manager Console
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
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>
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屋!