标签:
注意:要采用Nuget进行安装,否则可能会缺少相应的dll或者是配置信息
1、将entitframework节点替代为:
| 1 2 3 4 5 6 7 | <entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">    <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> | 
2、添加 ConnectionString节点:
| 1 2 3 | <connectionStrings>    <addname="MyContext"connectionString="Data Source=localhost;port=3306;Initial Catalog=数据库名称;user id=Mysql的登录用户名;password=Mysql server密码;"providerName="MySql.Data.MySqlClient"/>  </connectionStrings> | 
Entity Framework连接Mysql数据库并生成Model和DAL层
标签:
原文地址:http://www.cnblogs.com/aipohoo/p/5402230.html