编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

极客时间

在VS2019中将实体框架与MYSQL连接:Connect Entity Framework with MYSQL in VS2019

NAThompson mysql 2022-5-11 10:23 11人围观

腾讯云服务器
在VS2019中将实体框架与MYSQL连接的处理方法

我刚刚安装了Visual Studio 2019,并且试图添加具有ADO.NET实体模型的数据库,但是向导在此步骤中崩溃...

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...

选择实体框架版本

我有Visual Studio Community 2019 v16.4.5 已安装MySQL for Visual Studio 1.2.9 已安装MySQL连接器net 8.0.19

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

我将引用添加到我的项目中MySQL.data EF6的MySQL.data.EntityFramework MySQL.web

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

所有版本8.0.19,与连接器相同

all version 8.0.19, same as the connector

我也尝试从nuget包中添加EntityFramework MySqlData MySql.Data.Entity MySql.Web

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

并将其添加到web.config

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

您的项目引用了最新版本的Entity Framework

有人可以帮忙吗?我要添加wearg版本吗?

Can someone please help? Am I adding worng versions?

问题解答

好吧,几天之后,我终于可以添加我的数据库了.我看到其他人的评论说ADO向导崩溃了,所以这就是我所做的...

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...

使用VS Community 2019已安装最新版本的MySQL连接器网适用于Visual Studio的MySQL

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

创建项目后,我去管理NuGet软件包并安装了最新版本的Entity Framework

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

然后在参考文献中添加了EF6的MySql.Data.EntityFramework

Then in references added MySql.Data.EntityFramework for EF6

然后将其添加到我的web.config

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!

写MySql.Data.EntityFramework而不是.EF6非常重要

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

这篇关于在VS2019中将实体框架与MYSQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!

腾讯云服务器 阿里云服务器
关注微信
^