3

When I'm trying to use Entity framework to connect to a MySQL database (using 'CodeFirst from database' option), after pressing next at 'Choose Your Data Connection', the Entity Data Model wizard closes and at Server Explorer, I see that the Data Connection closes too. I had followed the steps from the first comment of this question Enable Entity Framework 6 for MySql (C#) in WinForms of Microsoft Visual Studio 2013 on an MVC Project and over a WinForms project, but I can't find the problem in my particular case; any ideas of what I could have done wrong? (When I test the connection it says that was succesfull and when I press 'Retrieve Data' and add a new row, the changes are saved over the server). Not even creates a new connection string in my Web.Config or App.Config files.

Community
  • 1
  • 1
Juan De la Cruz
  • 436
  • 6
  • 17

1 Answers1

0

I found a way to use Entity Framework 6 with MySQL in an MVC 5 project using Visual Studio 2013 Community Edition(Sorry if to an advanced user one of this steps don't make sense, but this worked with me). First I installed the last versions (at May 2015) of:

Then I changed the dll files
- MySql.Data.dll - MySql.Data.Entity.EF6.dll - MySql.Web.dll from C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.6\Assemblies\v4.5 to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Then, after you create the MVC 5 project, with the package manager console, I executed the next commands

  • Install-Package MySql.Data
  • Install-Package MySql.Data.Entity
  • Install-Package MySql.Web

I build the project and, after build, the connections settings are added to the Web.Config file. From this moment, I am able to use Entity Framework Code First with an MySQL database. Hope it works for others!

Juan De la Cruz
  • 436
  • 6
  • 17