"The provider did not return a ProviderManifestToken string" MySQL with Entity Framework

entity-framework-6 mysql

Popular Answer

Recently, I've been experiencing the same issues as you. In SQL Server, everything operated without a hitch, but after switching to MySQL, I ran into several issues. Some things that worked for me are:

    Install-Package MySQL.Data -Version 6.9.9
    Install-Package MySql.Data.Entity -Version 6.9.10

There seem to be issues with the more recent MySQL 8.0 packages. It worked when I went back to an earlier version.

Your app.config should seem as follows:

      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <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, Version=6.8.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
    </providers>
  </entityFramework>
  <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.10.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <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.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
</configuration>

Even after that, I'm just now becoming aware of a few differences in MySQL. For example, your migration "index" statements will not work. The migration file must be modified, and the index must be created manually. Another thing that I just read, but haven't encountered, is that the MySQL driver does not allow multiple connections which may mean changing the way you retrieve async collections. The last issue I encountered was with RowVersion being a byte[. To resolve this, I used a version from the following article (let's hope!).

A better approach to use MySQL and EF Core to construct a row version?

14
5/1/2018 5:19:11 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow