问题
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?
回答1:
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
回答2:
You can try pomelo.EntityFrameworkCore.Mysql provider
来源:https://stackoverflow.com/questions/60386441/connect-entity-framework-with-mysql-in-vs2019