valeria
valeria

Reputation: 111

Connect Entity Framework with MYSQL in VS2019

I just installed Visual Studio 2019 and I´m trying to add a database with an ADO.NET entity model, but the wizard crashes in this step...

Select Entity Framework Version

I have Visual Studio Community 2019 v16.4.5
Installed MySQL for Visual Studio 1.2.9
Installed MySQL connector net 8.0.19

I added the references to my project
MySQL.data
MySQL.data.EntityFramework for EF6
MySQL.web

all version 8.0.19, same as the connector

I also tried adding from nuget packages
EntityFramework
MySqlData
MySql.Data.Entity
MySql.Web

and added this to web.config

<entityFramework>
<providers>
<provider invariantName="MySql.Data.MySqlClient"
type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>

and tried everything I've read but it still doesnt work, it just crashes after that or it gives me this error

Your Project references the latest version of Entity Framework

Can someone please help? Am I adding worng versions?

Upvotes: 4

Views: 8132

Answers (3)

William T. Mallard
William T. Mallard

Reputation: 1660

In my case the <entity_framework> tags were there but malformatted and with an unversioned duplicate entry. Fixing that (FINALLY!!!) got a clean model generated.

Upvotes: 0

valeria
valeria

Reputation: 111

Okay, after many days I finally could add my data base. I've seen comments of others saying the ADO wizard crashes so here's what I did...

With VS Community 2019 Installed latest versions of
MySQL connector net
MySQL for Visual Studio

After created my project I went to admin NuGet packages and installed latest version of Entity Framework

Then in references added
MySql.Data.EntityFramework for EF6

Then added this to my web.config

<entityFramework>
    <providers>
     <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework" />
    </providers>
  </entityFramework>

Recompile And the wizard works just fine!

It was very important to write MySql.Data.EntityFramework and not .EF6

Upvotes: 7

Siva  Koteswara  Rao
Siva Koteswara Rao

Reputation: 129

You can try pomelo.EntityFrameworkCore.Mysql provider

Upvotes: 0

Related Questions