Cannot use MySQL connection for framework 6 entity

I am trying to use framework 6 entity with MySQL.

I installed the MySQL plugin for Visual Studio 1.1.1 and the MySQL.Net connector 6.8.3.

The problem is that when I try to create a new Entity ADO.NET model, I cannot choose MySQL to connect.

enter image description here

But if I create a connection from the connection tool in visual studio, I can see MySQL

enter image description here

This means that the installed version is not compatible with the infrastructure of entity 6. As possible after this, I installed the last connector and plug-in. Is there anything else?

thank

EDIT

I did a fresh install of MySQL without installing a default connector, and then I installed 6.8.3 and the plugin for visual studio.

Then I see the connection that I created for my Entity model, but when I am going to select the version of the entity, I get this message.

enter image description here

+51
mysql visual-studio-2013 entity-framework
Jan 18 '14 at 15:37
source share
9 answers

LAST CHANGE

Bug fixed.

Chris Comment:

2015-11-07, and now you can work without editing files or doing strange things. Use the MySQL installer for Windows and including support for Visual Studio and the latest version of Connector.Net. Be sure to update after installation, and you will receive the latest information about each (1.2.5 and 6.9.8). Use NuGet to set EntityFramework, MySql.Data, and MySql.Data.Entity. Finally, we built and enjoyed reverse engineering code technical competency by adding the Ento.Net Ado.Net model.

Original answer

I found an error in MySQL.

Below is a link explaining the desktop.

On your computer where VS 2013 is installed, the VS plug-in (1.1.3 GA) and Connector / Network

Close all VS instances before completing the steps.

In the Windows Explorer window, go to this path or where you installed the Connection / Network 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 into this folder

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

If you ask him to overwrite, do it.

You will need administrator rights to overwrite the file.

Then you can try again to create a script for your model.

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

Unfortunately, this does not work for me, so I abandoned the structure of entity 5 until I fix it.

EDIT

Finally, it now works.

I had to add the following 3 DLLs:

  • C: \ Program Files (x86) \ MySQL \ MySQL Connector Net 6.8.3 \ Assemblies \ v4.5 \ MySql.Data.dll
  • C: \ Program Files (x86) \ MySQL \ MySQL Connector Net 6.8.3 \ Assemblies \ v4.5 \ MySql.Data.Entity.EF6.dll
  • C: \ Program Files (x86) \ MySQL \ MySQL Connector Net 6.8.3 \ Assemblies \ v4.5 \ MySql.Web.dll

Then I changed the EntityFramework part in the web configuration 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> 

Do not forget REBUILD , and you can create a framework 6 entity model with MySQL.

IMPORTANT

Make sure you install MySQL for Visual Studio 1.1.3 and the MySQL.net 6.8.3 Connector

+52
Jan 19 '14 at 2:35
source share

DECISION! 2017

Install Nuget Package:

 Install-Package EntityFramework Install-Package MySql.Data.Entity -Version 6.9.9 

Installing MySQL for Visual Studio 1.2.6 - https://dev.mysql.com/downloads/windows/visualstudio/

Changes to Web.Config

 <EntityFramework> 

at

 <EntityFramework codeConfigurationType = "MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"> 

Add (** your information **):

 <connectionStrings> <add name="**YourContextName**" connectionString="server=**xxx.xxx.xxx.xxx**;port=3306;user id=**your user**;password=**your password**;database=**your database**" providerName="MySql.Data.MySqlClient" /></connectionStrings> 


Restart Visual Studio

My settings:
- Microsoft Visual Studio Community 2015
- Dot Net Framework 4.5.2
- Asp.Net MVC 5.2.3.0
- MySql Server 5.6

+10
Feb 20 '17 at 12:32
source share

Not sure if this is still a problem for you guys, but none of the above solutions worked for me ... until I found this:

http://www.microsoft.com/en-us/download/details.aspx?id=40762

After applying the patches (for VS2013 and VS2012), I got VS2013 working perfectly with EF6 for MySql.

ps. Installed package versions (from NuGet):
EntityFramework - 6.1.3 (10/03/2015)
MySqlData - 6.9.6 (02/24/2015)
MySql.Data.Entity - 6.9.6 (02/24/2015)
MySql.Web - 6.9.6 (02/24/2015)

NuGet does the job correctly and updates Web.Config accordingly, filling out the "entityFramework" section with everything you need.

For VS2013, it just goes from "Doesn't work at all" to "Fully functional." For VS2012, it allows you to use "Code First from Database", which was not available before applying the patch.

It is a pity that I did not find this about 10 days ago, so I hope this can still help.

+6
Apr 23 '15 at 2:47
source share

For me, reinstalling MySQL and using the installed version of the connector as a link in Visual Studio worked!

Steps:

  • Reinstall MySQL tools with the latest stable MySQL connector for Windows.
  • Add these 3 files as a reference in Visual Studio:

  • MySql.Data.dll

  • MySql.Data.Entity.EF6.dll
  • MySql.Web.dll

  • Change the following web.config from

      <providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers> 

To:

  <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" /> </providers> 

Verify that the username / password / domain name is connected correctly or that a crash can occur in Visual Studio. (Happened to me.)

+2
Aug 01 '15 at 2:00
source share

Have you tried to install the last network point connector for my sql? http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html or http://dev.mysql.com/downloads/connector/net/ depending on your context.

0
Jan 19 '14 at 7:48
source share

2015-11-07 Update

Bugs have been fixed, and now you can work without editing any files or even reference assemblies outside of NuGet. You just need to install the right thing and add the right NuGet packages. Here's how:

Use the MySQL installer for Windows and enable Visual Studio support and the latest version of Connector.Net. Be sure to update after installation, and you will get the latest one (1.2.5 and 6.9.8).

Then use NuGet to set the EntityFramework, MySql.Data, and MySql.Data.Entity.

Finally, create and enjoy reverse engineering code by adding the Ento.Net Ado.Net model.

0
Dec 18 '15 at 13:02
source share

I found this on mySQL Bucktracker

Try the following workaround ....

Run the following command in the MySQL database, and then try if this works.

set global optimizer_switch = 'derived_merge = off'

I also added the following assemblies:

  • EF6 as a Nuget Package
  • MySQL.Data li>
  • MySql.Data.Entity.EF6.dll
  • MySQL.Web (not sure if this is really necessary)
0
Jan 05 '16 at 10:26
source share

FYI for everyone who uses a multi-project solution, if you cannot start the GUI project due to problems with finding / loading the MySql EF6 provider, for example:

For the ADO.NET provider, the Entity Framework provider with the invariant name "MySql.Data. (...)" was not found. Make sure the provider is registered in the "entityFramework" section of the application configuration file. See http://go.microsoft.com/fwlink/?LinkId=260882 for details.

see this question .

Although the problem with SqlServer may be the same: if only one of your projects handles database operations, then most likely you have added Nuget links to MySql.Data and MySql.Data.Entity and EntityFramework to this project. Since MySql.Data and EntityFramework are used directly by the code, the build process is smart enough to copy them to the output folder and copy it a second time to the output folder of the GUI project.

However, since MySql.Data.Entity only refers to the text file app.config or web.config , the build process believes that this link is not needed (the code does not use it!) and deletes it, and you will not see MySql.Data.Entity.EF6.dll in the output directory of the GUI project, and this will lead to the GUI project not can find this provider.

So - two options - make sure that something copies this DLL as part of the build process (for example, the pre / post build event, deployment package linker, CI task, human task, or something else) or just directly reference the assemblies in your DB / EF6 project.

0
May 21 '17 at 20:29
source share

I had the same problem.

I have done the following:
1. Install MySQL for Visual Studio with:
https://dev.mysql.com/downloads/windows/visualstudio/
2. Install MySql.Data in my project
3. Install MySql.Data.EntityFramework in my project

0
Jul 10 '18 at 16:04
source share



All Articles