Visual Studio 2013 中 mysql 使用 EF6
1.web.config
<configSections> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> <system.data> <DbProviderFactories> <!-- 不设置这里会提示找不到提供程序--> <add name="MySQL" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/> </DbProviderFactories> </system.data>
<entityFramework> <!-- 默认设置的sql--> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> </providers> </entityFramework>
需要支持的东西:
1.mysql-for-visualstudio-1.1.4.msi 下载地址:http://dev.mysql.com/downloads/file.php?id=451295
2.mysql-connector-net-6.8.3.msi 下载地址:http://dev.mysql.com/downloads/file.php?id=450594