• EF 配置MySQL


    添加 mysql dll 引用

    WebConfig 配置:

    1.先添加connectionstrings,providerName 换成 mysql的

    <connectionStrings>
        <add name="ECSWebDb" connectionString="User Id=xxx;server=.;Database=xxx;pwd=xxx;Persist Security Info=True;"
             providerName="MySql.Data.MySqlClient"/>
      </connectionStrings>

    2.EF 添加Provider的 配置

    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="mysqllocaldb" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
          <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"/>
        </providers>
      </entityFramework>
    

    3. system.data 增加 DbProviderFactories

    <system.data>
        <DbProviderFactories>
          <remove invariant="MySql.Data.MySqlClient" />
          <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
        </DbProviderFactories>
      </system.data>
    

      

  • 相关阅读:
    Sectong日志分析
    风暴中心
    安全趋势:
    Mysql table ful
    linux service命令常见使用方法
    client denied by server configuration
    Ubuntu配置apache
    O2O助汪峰成功逆袭,汪峰最终上头条了
    Android切图注意事项
    2014/08/23——OJ及相关站点打开速度非常慢,训练计划login直接error!
  • 原文地址:https://www.cnblogs.com/zhaozhengyan/p/5287060.html
Copyright © 2020-2023  润新知