MVC scaffolding does not support Entity Framework 6 or later(MVC 脚手架不支持 Entity Framework 6 或更高版本)
问题描述
刚刚升级到 Entity Framework 6 来看看.我正在使用 MVC4.
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 脚手架不支持 Entity Framework 6 或更高版本
MVC scaffolding does not support Entity Framework 6 or later
推荐答案
认为这可以使用一些扩展 :) 如上所述 ASP.NET MVC 4 脚手架不支持 EF6 或更高版本.这意味着必须安装与 MVC 4 兼容的旧版 EF.为此:
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:
- 打开包管理器控制台:
- 选择工具 -> 库包管理器 -> 包管理器控制台
在包管理器控制台中,通过执行以下命令卸载当前的 EF 包:
In the Package Manager Console, uninstall the current EF package by executing the following command:
UnInstall-Package EntityFramework -Version <版本号>
*其中 是当前安装的 EF 的版本号.
*注意:要了解安装的 EF 版本,请在包管理器控制台中运行以下命令:
*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
为避免潜在的元数据问题,需要删除 Web.config 文件中的提供程序条目:
To avoid potential metadata problems the providers entry in the Web.config file will need to be removed:
- 打开项目目录下的 Web.config 文件.
删除以下行:
- Open the Web.config file in the project directory.
Delete the following lines:
<代码><提供者><provider invariantName=System.Data.SqlClient 类型=System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer/></providers>
现在,在包管理器控制台中执行以下命令安装Entity Framework 5.0.0:
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 脚手架不支持 Entity Framework 6 或更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MVC 脚手架不支持 Entity Framework 6 或更高版本
基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
