加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 无法通过Visual Studio 2013中的EF6连接到MySQL

发布时间:2020-12-15 08:06:29 所属栏目:百科 来源:网络整理
导读:我试图在Visual Studio中使用EF6连接到MYSQL数据库,后来我使用SQL并且它工作正常后我转移到Mysql然后我安装了这样的必需组件: MySQL for Visual Studio 1.1.1 MySQL Connector / Net 6.8. 错误说: Your project references the latest version of Entity F
我试图在Visual Studio中使用EF6连接到MYSQL数据库,后来我使用SQL并且它工作正常后我转移到Mysql然后我安装了这样的必需组件:

> MySQL for Visual Studio 1.1.1
> MySQL Connector / Net 6.8.

错误说:

Your project references the latest version of Entity Framework; however,an Entity Framework database provider compatible with this version could not be found for you data connection. Exit this wizard,install a compatible provider,and rebuild your project before performing this action

我尝试了可能的在线解决方案,例如重新安装此组件,但它不起作用,
否则我试图将这样的代码添加到我的App.config:

<configuration>
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory,MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity.EF6" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

但它面临相同的命运,或事件清除我的app.config中的所有实体标签.
我还试图安装更高版本的实体,如:

Install-Package EntityFramework -Version 5.0.0

但它得到:安装失败.滚回来…
安装包:已经引用了更新版本的’EntityFramework’.

任何人都可以帮我确定我该怎么办?

解决方法

这对我有用,无需重新安装Visual Studio或任何其他任何东西.

>安装了最新的MySQL visual studio插件和MySQL连接器网
>删除了App.config或Web.config中的entityFramework标记及其所有子标记.
>用以下代码替换它:

<entityFramework> <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory,MySql.Data.Entity.EF6" /> <providers> <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices,MySql.Data.Entity.EF6" /> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer" /> </providers> </entityFramework>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读