VS 2013 EF6
维护一个老项目,需要添加数据库,添加得了EF6引用后,Install-Package EntityFramework -Version 6.1.1,项目右键添加ADO.Net Entity Data Model,出现如下问题:Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatibale with this version could not be found for your data connectino.
就是找不到合适的data connetor,需要手动添加:添加引用 MySQL.Data,MySQL.Data.Entity.EF6
修改Config
<entityFramework> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" /> <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>
重新编译项目,然后再添加就可以了