[英]MVC scaffolding does not support Entity Framework 6 or later
Just upgraded to Entity Framework 6 to take a look. 刚刚升级到Entity Framework 6来看看。 I'm using MVC4. 我正在使用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 MVC脚手架不支持Entity Framework 6或更高版本
Thought this could use some expanding :) As mentioned above ASP.NET MVC 4 scaffolding does not support EF6 or higher. 认为这可以使用一些扩展:)如上所述,ASP.NET MVC 4脚手架不支持EF6或更高版本。 This means that an older EF, compatible with MVC 4 will have to be installed. 这意味着必须安装与MVC 4兼容的旧EF。 To do this: 去做这个:
In the Package Manager Console, uninstall the current EF package by executing the following command: 在程序包管理器控制台中,通过执行以下命令卸载当前的EF程序包:
UnInstall-Package EntityFramework -Version <version number>
*Where <version number>
is the version number of the EF currently installed. *其中<version number>
是当前安装的EF的版本号。
*NOTE: to find out what EF version is installed, run the following command in the Package Manager Console: *注意:要找出安装的EF版本,请在程序包管理器控制台中运行以下命令:
Get-Package EntityFramework
To avoid potential metadata problems the providers entry in the Web.config file will need to be removed: 为避免潜在的元数据问题,需要删除Web.config文件中的提供程序条目:
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: 现在,在程序包管理器控制台中执行以下命令以安装Entity Framework 5.0.0:
Install-Package EntityFramework -Version 5.0.0
After a bit more digging 经过多一点挖掘
ASP.NET MVC 4 scaffolding does not support Entity Framework 6 or higher. ASP.NET MVC 4脚手架不支持Entity Framework 6或更高版本。 Support of scaffolding of Entity Framework 6 is targeted for the next release of ASP.NET MVC. 支持Entity Framework 6的脚手架是针对ASP.NET MVC的下一个版本。
So looks like ill wait until MVC 5 is properly released 所以看起来好像等待MVC 5正确发布
ASP.NET MVC 4 scaffolding does not support Entity Framework 6 or later. ASP.NET MVC 4脚手架不支持Entity Framework 6或更高版本。 Support for scaffolding will be included in MVC5. 支持脚手架将包含在MVC5中。 Work around is to use EF5 for scaffolding and then upgrade to EF6. 解决方法是使用EF5进行脚手架,然后升级到EF6。
http://support.microsoft.com/kb/2816241 http://support.microsoft.com/kb/2816241
Workaround which worked for me to scaffold controllers and views for MVC 4 and EF 6 : 解决方法对我来说是支持MVC 4和EF 6的控制器和视图:
This is a solution to generate scaffolding if you do not want to downgrade the EF Version. 如果您不想降级EF版本,这是生成脚手架的解决方案。
For me this worked out of the box 对我来说,这开箱即用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.