Can't use a MySQL connection for entity framework 6

entity-framework mysql visual-studio-2013

Question

I'm attempting to use MySQL with entity framework 6.

I did set up the MySQL.Net connector 6.8.3 and the MySQL plugin for Visual Studio 1.1.1.

The issue is that I am unable to select MySQL as the connection while trying to create a new ADO.NET Entity model.

enter image description here

However, if I build a connection using Visual Studio's connection tool, I can see MySQL.

enter image description here

This indicates that entity framework 6 is not compatible with the version that is presently installed. How is it possible that after installing the most recent connector and plugin, this happened? Are there any more tasks?

Many thanks

EDIT

Without using the default connector, I installed MySQL completely from scratch before installing version 6.8.3 and the visual studio plugin.

I can then see the connection I created for my entity model, but I get this message just as I'm about to select the entity version.

enter image description here

1
57
1/18/2014 6:14:30 PM

Accepted Answer

CURRENT EDIT

The issue has been resolved.

Chris's remark

2015-11-07 and you can now get it all working without editing any files or doing weird stuff. Use the MySQL for Windows installer and include the Visual Studio support and the latest Connector.Net. Be sure to update after installing and you will get the latest of each (1.2.5 and 6.9.8). Use NuGet to install EntityFramework, MySql.Data, and MySql.Data.Entity. Finally, built and enjoy code-first reverse engineering goodness by adding an Ado.Net Entity Model.

original response

I discovered that it's a MySQL bug.

The link describing a workaround is Here's.

On your machine where VS 2013 is installed, VS plugin (1.1.3 GA) and Connector/Net

Close all VS instances before doing the steps.

On a Windows Explorer window go to this path or wherever you installed you Connector/net binaries

C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\

Copy the file:

MySql.Data.Entity.EF6.dll

And paste it to this folder

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies

If it asks you to overwrite it please do so.

You'll need admin rights in order to overwrite the file.

Then you can try again to generate the script for your model.

It is important that you have the 1.1.3 version of the VS plugin installed since this workaround is for that.

Unfortunately, I can't get it to work, so I've switched back to entity framework 5 till they fix it.

EDIT

Finally, it is functional.

I have to include the three DLLs below:

  • Program Files (x86) in C: MySQL Connector Net 6.8.3 Assembly Version 4.5 for MySQL MySql.Data.dll
  • Program Files (x86) in C: MySQL Connector Net 6.8.3 Assembly Version 4.5 for MySQL MySql.Data.Entity.EF6.dll
  • Program Files (x86) in C: MySQL Connector Net 6.8.3 Assembly Version 4.5 for MySQL MySql.Web.dll

The EntityFramework component of the web configuration was then updated to:

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> 
    </providers>
  </entityFramework>

You should be able to use MySQL to generate an entity framework 6 model if you remember to REBUILD.

IMPORTANT

Make sure MySQL connector.net 6.8.3 and MySQL for Visual Studio 1.1.3 are installed.

54
12/18/2015 8:13:40 PM

Popular Answer

ZZZ_tmp


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