Entity Framework defaultConnectionFactory for MySQL

后端 未结 1 1660
轻奢々
轻奢々 2021-01-14 21:04

The below configuration works fine when I specify the connectionString name as a parameter to the base constructor. Because I want to be able to change the default provider

相关标签:
1条回答
  • 2021-01-14 21:33

    The name property of the connectionString must be the same as your context. This works fine:

      <connectionStrings>
        <add name="NAMEOFYOURCONTEXT" providerName="MySql.Data.MySqlClient" connectionString="Server=localhost;Database=abc;Uid=root;Pwd='';" />
      </connectionStrings>
      <entityFramework>
        <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"></defaultConnectionFactory>
        <providers>
          <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"></provider>
        </providers>
      </entityFramework>
    
    0 讨论(0)
提交回复
热议问题