无法在 Visual Studio 2013 中通过 EF6 连接到 MySQL [英] Could not connect to MySQL through EF6 in Visual Studio 2013

查看:24
本文介绍了无法在 Visual Studio 2013 中通过 EF6 连接到 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Visual Studio 中使用 EF6 连接到 MYSQL 数据库,后来我使用 SQL 并且它工作正常,然后我转移到 Mysql 然后我安装了这些必需的组件:

I am trying to connect to MYSQL Database using EF6 in visual studio , later i was using SQL and it worked fine afterwards i shifted to Mysql then i install such this required components :

  • 适用于 Visual Studio 1.1.1 的 MySQL
  • MySQL 连接器/网络 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 中:

i tried possible online solutions e.g reinstall this components but it did not work , Otherwise this i tried to add such this code to my App.config :

<代码><配置><实体框架><defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/><提供者><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"/></提供者></实体框架></配置>

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

but it face the same destiny, or event clear all entity tags from my app.config . also i tried to install later version of entity such :

Install-Package EntityFramework -Version 5.0.0

Install-Package EntityFramework -Version 5.0.0

但它得到:安装失败.滚回来...Install-Package : 已经引用了较新版本的EntityFramework".

谁能帮我确定我应该怎么做?

can anyone help me to identify what should i do then ?

推荐答案

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

This worked for me WITHOUT reinstalling the Visual Studio or anything what so ever.

  • 安装了最新的 MySQL Visual Studio 插件和 MySQL 连接器网络
  • 移除 App.config 或 Web.config 中的 entityFramework 标签及其所有子标签.
  • 将其替换为以下代码:

<entityFramework><defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"/><提供者><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"/></提供者></entityFramework>

这篇关于无法在 Visual Studio 2013 中通过 EF6 连接到 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆