[英]EntityFramework Error
New Project - Class Library 新项目-类库
Guget Packages - Install-Package EntityFramework, Install-Package MySql.Data, Install-Package MySql.Data.Entities, Install-Package MySql.Web Guget软件包-安装软件包EntityFramework,安装软件包MySql.Data,安装软件包MySql.Data.Entities,安装软件包MySql.Web
<entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> </entityFramework>
Add New Item - ADO.NET Entity Data Model 添加新项-ADO.NET实体数据模型
Empty EF Designer - Finish 空的EF设计器-完成
Right Click on the model properties and then DDL Generation Template to SSDLToMySQL.tt 右键单击模型属性,然后单击“ DDL生成模板”到SSDLToMySQL.tt
Sample entity added 样本实体已添加
Build Solution 建立解决方案
Right Click- Generate Database from Model 右键单击-从模型生成数据库
Select Data Connection and hit next. 选择数据连接,然后单击下一步。
Then the window close and nothing happen. 然后,窗口关闭,什么也没有发生。
Adding References Using NuGet Versus an Extension SDK 使用NuGet和扩展SDK添加参考
Install the EF6 NuGet package 安装EF6 NuGet软件包
You need to upgrade to the new Entity Framework 6 runtime. 您需要升级到新的Entity Framework 6运行时。
Right-click on your project and select Manage NuGet Packages... 右键单击您的项目,然后选择管理NuGet软件包...。
Under the Online tab select EntityFramework and click Install 在“联机”选项卡下,选择EntityFramework,然后单击“安装”。
Note: If a previous version of the EntityFramework NuGet package was installed this will upgrade it to EF6. 注意:如果安装了EntityFramework NuGet程序包的早期版本,它将升级到EF6。
Checklist: 清单:
EF5 is built into the core of .NET 4.5, whereas EF6 has been shifted out, and is open source. EF5内置于.NET 4.5的核心中,而EF6已被移出,并且是开源的。
EF5 has a single .dll "EntityFramework.dll", whereas EF6 has two .dlls: EF5具有单个.dll“ EntityFramework.dll”,而EF6具有两个.dll:
The namespaces have changed: 名称空间已更改:
This checklist is a Community Wiki, 此清单是社区Wiki,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.