Bug #78228 .NET Connector 6.9.7 does not work for Entity Framework 6.x - Visual Studio 2015
Submitted: 26 Aug 2015 14:53 Modified: 2 Sep 2015 19:22
Reporter: Marcilio Meira Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.9.7 OS:Windows (10)
Assigned to: CPU Architecture:Any
Tags: Entity Framework 6, mysql-connector-net-6.9.7, Visual Studio 2015

[26 Aug 2015 14:53] Marcilio Meira
Description:
MySQL Connector NET 6.9.7 does not work for Entity Framework 6.x on Visual Studio 2015. I could not create a Entity Framework Model from a MySQL Database, on a MVC 5 ASP.NET Project.

How to repeat:
Install Visual Studio Enterprise 2015, install MySQL Communit 5.6.23.0 version, install MySQL connector NET 6.9.7, install "MySQL for Visual Studio" 1.2.4.
After that, on Visual Studio 2015, New Project ASP.NET Web Application, choose MVC Template, and uncheck "Host in the cloud".
Right click on Models folder, Add -> New Item, choose "ADO.NET Entity Data Model", choose "EF Designer from database", choose your MySQL Connection, and Next. Now, on this step, it displayed a message informing that an "Entity Framework database provider compatible with this version could not be found for your data connection."

Suggested fix:
Not found yet.
[27 Aug 2015 2:19] Marcilio Meira
Problem solved, after a lot of researches over the Internet. Here is the steps:

1) Overwrite Assemblies: MySql.Data.dll, MySql.Data.Entity.EF6.dll, MySql.Web.dll, copying and pasting
from "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.7\Assemblies\v4.5"
to "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\PrivateAssemblies"

2) Edit web.config, adding or overwriting existing tags bellow:

<entityFramework>
    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <clear />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,                   MySql.Data" />
    </DbProviderFactories>
  </system.data>
[31 Aug 2015 17:45] Marcilio Meira
Sorry, I missed one last step.

3) Right click over References on Solution Explorer (your Project is supposed to be opened), and select "Add Reference...".  Choose 3 assemblies to be added: MySql.Data, MySql.Data.Entity and MySql.Data.Entity for EF6, and "OK".

The last point is we really don't need the line on web.config about SqlServer provider. So you can comment that line:
<!--provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /-->

That is it!
[2 Sep 2015 19:22] Marcilio Meira
One last details for Visual Studio 2013's users, is on step 1, after adding the 3 mysql assemblies references (MySql.Data.dll, MySql.Data.Entity.EF6.dll, MySql.Web.dll), change the property "Copy Local" to "TRUE" for the 3 assemblies.