MariaDB10.04l使用EF5.0code first

工具:vs2012+MairaDB10.04+mysql-connector-net6.74

    现在使用Nuget安装的EF版本是6.01;目前Mysql的.net驱动只支持5.0.(白搞了大半天,具体在哪看到的忘了,测试也是不支持6.0)

   下面是配置文件

<configuration>
  <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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    
  </system.web>
  <system.data>
 <!--没有这个会提示 找不到请求的 .Net Framework Data Provider。可能没有安装-->
<DbProviderFactories> 
<add name="MySQL Data Provider" 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"> <parameters> <parameter value="v11.0" /> </parameters> </defaultConnectionFactory> </entityFramework> <connectionStrings> <add name="mysqlConn" connectionString="DataSource=localhost;DataBase=....;uid=root;pwd=...." providerName="MySql.Data.MySqlClient" /> </connectionStrings> </configuration>

 



posted @ 2013-10-24 00:39  2GyAn  阅读(396)  评论(0编辑  收藏  举报