Entity Framework wizard crashes on MySQL

My question is similar to this one but the crash happens later. I must interoperate an EF database-first model between SQL Server and MySQL. More specifically, my application had plain SQL queries fired to either SQL Server or MySQL according to connection string and configuration setting (DB_TYPE=MYSQL, etc.), having both databases with same structure and maintained together, so that each modification to one's schema was reapplied to the other.

Now I added EF support to the application using SQL Server database-first model. I must now let the application run on MySQL too. In order to verify that the old developer didn't leave something disaligned between the two DBMSes, I tried to Update model against database* and this time I selected the MySQL connection to my development database on localhost.

After I click Next on the screen below, it will simply crash and return to EDMX editor

Data Model wizard

I need to go ahead with the project, I'm stuck on this since a while.

Here is my Web.config fragment:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </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.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

How can I solve my problem? I reinstalled MySQL tools for Visual Studio but didn't help.

*I use a localized version of Visual Studio, so I don't know the original English for all commands


Solution 1:

I have no idea why this works but I went in to my NuGet Package Manager and removed the MySql.Data.Entity (also checked dependencies which removed MySql.Data). I went into my .edmx and ran the 'Update model from database...' and everything worked.

(Note: This also removed my entity framework so I had to add that back in using the NuGet Manager)

W...T...F?

Maybe others can confirm this...

Solution 2:

It has been answered in another thread, the typical crash reason is the mismatched versions of MySQL connector and MySQL.Data.Entity.

And most likely reason for you to get the wrong version is because of the package name changed from MySQL.Data.Entity to MySql.Data.EntityFramework.

I was spending a lot of time on trying the answers in the thread, so just FYI.