无法在实体框架6中使用MySQL连接?

时间:2022-11-29 02:16:45

I'm trying to use entity framework 6 with MySQL.

我在尝试使用实体框架6和MySQL。

I did install MySQL plugin for visual studio 1.1.1 and MySQL .Net connector 6.8.3.

我为visual studio 1.1.1和MySQL。net connector 6.8.3安装了MySQL插件。

The problem is when I try to create a new ADO.NET Entity model, I can't choose MySQL for the connection.

问题是当我尝试创建一个新的ADO时。NET实体模型,我不能选择MySQL连接。

无法在实体框架6中使用MySQL连接?

But if I create a connection from the connection tool in visual studio, I can see MySQL

但是如果我在visual studio中创建一个连接工具,我可以看到MySQL

无法在实体框架6中使用MySQL连接?

It means that the version currently installed is not compatible with entity framework 6. How is it possible after that I installed the latest connector and the plugin. Is there anything else to do?

这意味着当前安装的版本与实体框架6不兼容。在我安装了最新的连接器和插件之后,怎么可能呢?还有别的事要做吗?

Thank you

谢谢你!

EDIT

编辑

I did a fresh install of MySQL without installing the default connector and then I installed the 6.8.3 and the plugin for visual studio.

我在没有安装默认连接器的情况下重新安装了MySQL,然后为visual studio安装了6.8.3和插件。

Then I can see the connection I made for my Entity model but when I'm about to choose the entity version, I get this message.

然后我可以看到我为我的实体模型建立的连接,但是当我将要选择实体版本时,我得到了这个消息。

无法在实体框架6中使用MySQL连接?

8 个解决方案

#1


52  

LATEST EDIT

最新的编辑

The bug has been fixed.

这个bug已经被修复了。

Chris' comment:

克里斯的评论:

2015-11-07 and you can now get it all working without editing any files or doing weird stuff. Use the MySQL for Windows installer and include the Visual Studio support and the latest Connector.Net. Be sure to update after installing and you will get the latest of each (1.2.5 and 6.9.8). Use NuGet to install EntityFramework, MySql.Data, and MySql.Data.Entity. Finally, built and enjoy code-first reverse engineering goodness by adding an Ado.Net Entity Model.

在2015-11-07赛季,你可以不用编辑任何文件或做一些奇怪的事情就能让一切正常运转。Windows安装程序使用MySQL,包括Visual Studio支持和最新的Connector.Net。安装后请务必更新,您将得到最新的版本(1.2.5和6.9.8)。使用NuGet安装EntityFramework, MySql。数据和MySql.Data.Entity。最后,通过添加Ado构建并享受代码优先反向工程的好处。净的实体模型。

Original answer

原来的答案

I found out it's a bug from MySQL.

我发现这是MySQL的一个错误。

Here's the link explaining a workarround.

这是解释一个解决方案的链接。

On your machine where VS 2013 is installed, VS plugin (1.1.3 GA) and Connector/Net

在安装VS 2013的机器上,VS plugin (1.1.3 GA)和Connector/Net

Close all VS instances before doing the steps.

在执行步骤之前关闭所有VS实例。

On a Windows Explorer window go to this path or wherever you installed you Connector/net binaries

在Windows资源管理器窗口中,访问此路径或安装连接器/net二进制文件的任何地方

C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\

C:\Program Files (x86)\MySQL\MySQL连接器净6.8.3 \ \ v4.5开发\组装

Copy the file:

复制文件:

MySql.Data.Entity.EF6.dll

MySql.Data.Entity.EF6.dll

And paste it to this folder

然后粘贴到这个文件夹

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies

C:\Program Files (x86)\Microsoft Visual Studio IDE 12.0 \ Common7 \ \ PrivateAssemblies

If it asks you to overwrite it please do so.

如果它要求您覆盖它,请这样做。

You'll need admin rights in order to overwrite the file.

为了覆盖文件,您需要管理员权限。

Then you can try again to generate the script for your model.

然后您可以再次尝试为您的模型生成脚本。

It is important that you have the 1.1.3 version of the VS plugin installed since this workaround is for that.

重要的是你已经安装了1.1.3版本的VS插件,因为这个解决方案就是为了这个。

Unfortunately it doesn't work for me, so I downgraded to entity framework 5 until they fix this.

不幸的是,它对我不起作用,所以我将它降级为entity framework 5,直到他们修复它。

EDIT

编辑

Finaly, it works now.

终于,现在它的工作原理。

I had to add the 3 following DLLs :

我必须添加以下3个dll:

  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Data.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Data.dll组装连接器
  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Data.Entity.EF6.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Data.Entity.EF6.dll组装连接器
  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Web.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Web.dll组装连接器

Then I changed the EntityFramework part in the web config to :

然后,我将web config中的EntityFramework部分更改为:

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> 
    </providers>
  </entityFramework>

Don't forget to REBUILD and you should be able to create a entity framework 6 model with MySQL.

不要忘记重新构建,您应该能够使用MySQL创建一个实体框架6模型。

IMPORTANT

重要的

Make sure you have installed MySQL for visual studio 1.1.3 and MySQL connector .net 6.8.3

确保您已经为visual studio 1.1.3和MySQL connector . 6.8.3安装了MySQL

#2


10  

SOLUTION! 2017

Install Nuget Package:

Nuget安装包:

Install-Package EntityFramework
Install-Package MySql.Data.Entity -Version 6.9.9

Install MySQL for Visual Studio 1.2.6   - https://dev.mysql.com/downloads/windows/visualstudio/

为Visual Studio 1.2.6安装MySQL - https://dev.mysql.com/downloads/windows/visualstudio/

Changes in Web.Config

在web . config中变化

<EntityFramework>

to:

:

<EntityFramework codeConfigurationType = "MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">

Add (** your information **):

添加(**您的信息*):

<connectionStrings>
<add name="**YourContextName**" connectionString="server=**xxx.xxx.xxx.xxx**;port=3306;user id=**your user**;password=**your password**;database=**your database**" providerName="MySql.Data.MySqlClient" /></connectionStrings>


Restart Visual Studio

重新启动Visual Studio

My Settings:
- Microsoft Visual Studio Community 2015
- Dot Net Framework 4.5.2
- Asp.Net MVC 5.2.3.0
- MySql Server 5.6

我的设置:- Microsoft Visual Studio Community 2015 - Dot Net Framework 4.5.2 - Asp。Net MVC 5.2.3.0 - MySql服务器5.6

#3


6  

Not sure if this is still a problem for you, guys, but none of the above solutions worked for me... until I found this:

我不确定这对你们来说是否仍然是个问题,但是以上的解决方案对我都不起作用……直到我发现了这个:

http://www.microsoft.com/en-us/download/details.aspx?id=40762

http://www.microsoft.com/en-us/download/details.aspx?id=40762

After applying the patches (for both VS2013 and VS2012), I got VS2013 working wonderfully with EF6 for MySql.

在应用了补丁(VS2013和VS2012)之后,我得到了VS2013与EF6的完美结合。

ps. Package versions installed (from NuGet):
EntityFramework - 6.1.3 (03/10/2015)
MySqlData - 6.9.6 (02/24/2015)
MySql.Data.Entity - 6.9.6 (02/24/2015)
MySql.Web - 6.9.6 (02/24/2015)

安装包版本(来自NuGet): EntityFramework - 6.1.3 (03/10/2015) MySqlData - 6.9.6 (02/24/2015) MySql.Data。实体- 6.9.6 (02/24/2015)MySql。Web - 6.9.6(02/24/2015)

NuGet does the job right and updates Web.Config accordingly, filling the "entityFramework" section with whatever needed.

NuGet做对了工作并更新了Web。相应地,在“entityFramework”部分中填充任何需要的内容。

For VS2013, it simply goes from "Not Working at all" to "Fully functional". For VS2012, it makes it possible to use "Code First from Database", which was not available before applying the patch.

对于VS2013来说,它只是从“完全不工作”到“功能齐全”。对于VS2012,它可以使用“来自数据库的代码”,这在应用补丁之前是不可用的。

I wish I had found this about 10 days ago, so hope this may still be of some help.

我希望我在10天前就发现了这一点,所以希望这能对我有所帮助。

#4


2  

For me reinstalling MySQL and using the installed connector version as a reference in Visual studio worked!

对于我来说,重新安装MySQL并使用已安装的连接器版本作为Visual studio中的参考是有效的!

Steps:

步骤:

  1. Reinstall MySQL Tools with the latest stable MySQL connector for windows.
  2. 使用最新稳定的windows MySQL连接器重新安装MySQL工具。
  3. Add this 3 files as reference in Visual Studio:

    在Visual Studio中添加这3个文件作为参考:

  4. MySql.Data.dll

    MySql.Data.dll

  5. MySql.Data.Entity.EF6.dll
  6. MySql.Data.Entity.EF6.dll
  7. MySql.Web.dll

    MySql.Web.dll

  8. Modify following Web.config from

    修改后的网络。配置从

      <providers>
        <provider invariantName="System.Data.SqlClient"  type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
    

To:

:

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

Make sure your connection username/password/db name are correct or Visual Studio may crash. (Happened with me.)

请确保您的连接用户名/密码/数据库名是正确的,否则Visual Studio可能会崩溃。(和我发生。)

#5


0  

Did you try to install the latest dot net connector for my sql ? http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html or http://dev.mysql.com/downloads/connector/net/ depending your context.

你试过为我的sql安装最新的。net连接器吗?http://dev.sqmyl.com/techresources/articles/mysql -installer-for windows s.html或http://dev.mysql.com/downloads/connector/net/取决于您的上下文。

#6


0  

2015-11-07 Update

2015-11-07更新

The bugs are fixed and you can now get it all working without editing any files or even referencing assemblies outside of NuGet. You simply have to install the right thing and add the right NuGet packages. Here's how:

bug已经修复,您现在可以在不编辑任何文件甚至不引用NuGet之外的程序集的情况下使其全部工作。您只需安装正确的东西并添加正确的NuGet包。方法如下:

Use the MySQL for Windows installer and include the Visual Studio support and the latest Connector.Net. Be sure to update after installing and you will get the latest of each (1.2.5 and 6.9.8).

Windows安装程序使用MySQL,包括Visual Studio支持和最新的Connector.Net。安装后请务必更新,您将得到最新的版本(1.2.5和6.9.8)。

Then, use NuGet to install EntityFramework, MySql.Data, and MySql.Data.Entity.

然后,使用NuGet安装EntityFramework, MySql。数据和MySql.Data.Entity。

Finally, build and enjoy code-first reverse engineering goodness by adding an Ado.Net Entity Model.

最后,通过添加Ado构建并享受代码优先反向工程的好处。净的实体模型。

#7


0  

i found this on the mySQL Bucktracker

我在mySQL Bucktracker上找到的

Try the following workaround....

尝试以下方法....

Run the following command on the MySQL DB and then try if this works.

在MySQL DB上运行以下命令,然后尝试这样做是否有效。

set global optimizer_switch='derived_merge=off'

集全球optimizer_switch = ' derived_merge =了'

I also added the following assemblies:

我还添加了以下程序集:

  • EF6 as Nuget package
  • EF6作为Nuget包
  • MySQL.Data
  • MySQL.Data
  • MySql.Data.Entity.EF6.dll
  • MySql.Data.Entity.EF6.dll
  • MySQL.Web (not sure if really needed)
  • MySQL。Web(不确定是否需要)

#8


0  

FYI for everyone using a multi-project solution, if you can't run your GUI project due to problems with finding/loading MySql EF6 provider, like:

对于使用多项目解决方案的每个人来说,如果由于查找/加载MySql EF6提供程序出现问题而无法运行GUI项目,比如:

No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.(...)'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

没有为ADO找到实体框架提供程序。具有不变量名“MySql.Data.(…)”的NET提供者。确保提供程序在应用程序配置文件的“entityFramework”部分注册。参见http://go.microsoft.com/fwlink/?LinkId = 260882的更多信息。

please see this question.

请查看这个问题。

Although it's about SqlServer the problem might be the same: if only one of your projects handles the DB operations, then most probably you added Nuget References to MySql.Data and MySql.Data.Entity and EntityFramework to that project. Since MySql.Data and EntityFramework are used directly by the code, the build process is smart enough to copy them to output folder, and to copy it second time to the GUI project's output folder as well.

虽然它是关于SqlServer的,但问题可能是相同的:如果您的一个项目处理了DB操作,那么很可能您添加了Nuget对MySql的引用。数据和MySql.Data。项目的实体和实体框架。因为MySql。数据和EntityFramework由代码直接使用,构建过程足够智能,可以将它们复制到输出文件夹,并将其第二次复制到GUI项目的输出文件夹中。

However, since MySql.Data.Entity is referred to only by the app.config or web.config text file, the build process thinks that this reference is not needed (the code does not use it!) and strips it away, and you won't see MySql.Data.Entity.EF6.dll in GUI project output dir, and this causes the GUI project to be unable to find that provider.

然而,由于MySql.Data。实体仅由app.config或web引用。配置文本文件,构建过程认为不需要这个引用(代码不使用它!)并将其删除,您将看不到MySql.Data.Entity.EF6。dll在GUI项目输出目录中,这会导致GUI项目无法找到该提供者。

So - two options - ensure that something copies that DLL there as a part of build process (i.e. pre/post build event, deployment package builder, CI task, human task, whatever), or just make a direct reference to the assembly in your DB/EF6 project.

因此——两个选项——确保某些东西将DLL作为构建过程的一部分复制到那里(例如,前/后构建事件、部署包构建器、CI任务、人工任务等等),或者直接引用DB/EF6项目中的程序集。

#1


52  

LATEST EDIT

最新的编辑

The bug has been fixed.

这个bug已经被修复了。

Chris' comment:

克里斯的评论:

2015-11-07 and you can now get it all working without editing any files or doing weird stuff. Use the MySQL for Windows installer and include the Visual Studio support and the latest Connector.Net. Be sure to update after installing and you will get the latest of each (1.2.5 and 6.9.8). Use NuGet to install EntityFramework, MySql.Data, and MySql.Data.Entity. Finally, built and enjoy code-first reverse engineering goodness by adding an Ado.Net Entity Model.

在2015-11-07赛季,你可以不用编辑任何文件或做一些奇怪的事情就能让一切正常运转。Windows安装程序使用MySQL,包括Visual Studio支持和最新的Connector.Net。安装后请务必更新,您将得到最新的版本(1.2.5和6.9.8)。使用NuGet安装EntityFramework, MySql。数据和MySql.Data.Entity。最后,通过添加Ado构建并享受代码优先反向工程的好处。净的实体模型。

Original answer

原来的答案

I found out it's a bug from MySQL.

我发现这是MySQL的一个错误。

Here's the link explaining a workarround.

这是解释一个解决方案的链接。

On your machine where VS 2013 is installed, VS plugin (1.1.3 GA) and Connector/Net

在安装VS 2013的机器上,VS plugin (1.1.3 GA)和Connector/Net

Close all VS instances before doing the steps.

在执行步骤之前关闭所有VS实例。

On a Windows Explorer window go to this path or wherever you installed you Connector/net binaries

在Windows资源管理器窗口中,访问此路径或安装连接器/net二进制文件的任何地方

C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\

C:\Program Files (x86)\MySQL\MySQL连接器净6.8.3 \ \ v4.5开发\组装

Copy the file:

复制文件:

MySql.Data.Entity.EF6.dll

MySql.Data.Entity.EF6.dll

And paste it to this folder

然后粘贴到这个文件夹

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies

C:\Program Files (x86)\Microsoft Visual Studio IDE 12.0 \ Common7 \ \ PrivateAssemblies

If it asks you to overwrite it please do so.

如果它要求您覆盖它,请这样做。

You'll need admin rights in order to overwrite the file.

为了覆盖文件,您需要管理员权限。

Then you can try again to generate the script for your model.

然后您可以再次尝试为您的模型生成脚本。

It is important that you have the 1.1.3 version of the VS plugin installed since this workaround is for that.

重要的是你已经安装了1.1.3版本的VS插件,因为这个解决方案就是为了这个。

Unfortunately it doesn't work for me, so I downgraded to entity framework 5 until they fix this.

不幸的是,它对我不起作用,所以我将它降级为entity framework 5,直到他们修复它。

EDIT

编辑

Finaly, it works now.

终于,现在它的工作原理。

I had to add the 3 following DLLs :

我必须添加以下3个dll:

  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Data.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Data.dll组装连接器
  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Data.Entity.EF6.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Data.Entity.EF6.dll组装连接器
  • C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\MySql.Web.dll
  • C:\Program Files (x86)\MySQL\MySQL净6.8.3 \ \ v4.5开发\ MySql.Web.dll组装连接器

Then I changed the EntityFramework part in the web config to :

然后,我将web config中的EntityFramework部分更改为:

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /> 
    </providers>
  </entityFramework>

Don't forget to REBUILD and you should be able to create a entity framework 6 model with MySQL.

不要忘记重新构建,您应该能够使用MySQL创建一个实体框架6模型。

IMPORTANT

重要的

Make sure you have installed MySQL for visual studio 1.1.3 and MySQL connector .net 6.8.3

确保您已经为visual studio 1.1.3和MySQL connector . 6.8.3安装了MySQL

#2


10  

SOLUTION! 2017

Install Nuget Package:

Nuget安装包:

Install-Package EntityFramework
Install-Package MySql.Data.Entity -Version 6.9.9

Install MySQL for Visual Studio 1.2.6   - https://dev.mysql.com/downloads/windows/visualstudio/

为Visual Studio 1.2.6安装MySQL - https://dev.mysql.com/downloads/windows/visualstudio/

Changes in Web.Config

在web . config中变化

<EntityFramework>

to:

:

<EntityFramework codeConfigurationType = "MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">

Add (** your information **):

添加(**您的信息*):

<connectionStrings>
<add name="**YourContextName**" connectionString="server=**xxx.xxx.xxx.xxx**;port=3306;user id=**your user**;password=**your password**;database=**your database**" providerName="MySql.Data.MySqlClient" /></connectionStrings>


Restart Visual Studio

重新启动Visual Studio

My Settings:
- Microsoft Visual Studio Community 2015
- Dot Net Framework 4.5.2
- Asp.Net MVC 5.2.3.0
- MySql Server 5.6

我的设置:- Microsoft Visual Studio Community 2015 - Dot Net Framework 4.5.2 - Asp。Net MVC 5.2.3.0 - MySql服务器5.6

#3


6  

Not sure if this is still a problem for you, guys, but none of the above solutions worked for me... until I found this:

我不确定这对你们来说是否仍然是个问题,但是以上的解决方案对我都不起作用……直到我发现了这个:

http://www.microsoft.com/en-us/download/details.aspx?id=40762

http://www.microsoft.com/en-us/download/details.aspx?id=40762

After applying the patches (for both VS2013 and VS2012), I got VS2013 working wonderfully with EF6 for MySql.

在应用了补丁(VS2013和VS2012)之后,我得到了VS2013与EF6的完美结合。

ps. Package versions installed (from NuGet):
EntityFramework - 6.1.3 (03/10/2015)
MySqlData - 6.9.6 (02/24/2015)
MySql.Data.Entity - 6.9.6 (02/24/2015)
MySql.Web - 6.9.6 (02/24/2015)

安装包版本(来自NuGet): EntityFramework - 6.1.3 (03/10/2015) MySqlData - 6.9.6 (02/24/2015) MySql.Data。实体- 6.9.6 (02/24/2015)MySql。Web - 6.9.6(02/24/2015)

NuGet does the job right and updates Web.Config accordingly, filling the "entityFramework" section with whatever needed.

NuGet做对了工作并更新了Web。相应地,在“entityFramework”部分中填充任何需要的内容。

For VS2013, it simply goes from "Not Working at all" to "Fully functional". For VS2012, it makes it possible to use "Code First from Database", which was not available before applying the patch.

对于VS2013来说,它只是从“完全不工作”到“功能齐全”。对于VS2012,它可以使用“来自数据库的代码”,这在应用补丁之前是不可用的。

I wish I had found this about 10 days ago, so hope this may still be of some help.

我希望我在10天前就发现了这一点,所以希望这能对我有所帮助。

#4


2  

For me reinstalling MySQL and using the installed connector version as a reference in Visual studio worked!

对于我来说,重新安装MySQL并使用已安装的连接器版本作为Visual studio中的参考是有效的!

Steps:

步骤:

  1. Reinstall MySQL Tools with the latest stable MySQL connector for windows.
  2. 使用最新稳定的windows MySQL连接器重新安装MySQL工具。
  3. Add this 3 files as reference in Visual Studio:

    在Visual Studio中添加这3个文件作为参考:

  4. MySql.Data.dll

    MySql.Data.dll

  5. MySql.Data.Entity.EF6.dll
  6. MySql.Data.Entity.EF6.dll
  7. MySql.Web.dll

    MySql.Web.dll

  8. Modify following Web.config from

    修改后的网络。配置从

      <providers>
        <provider invariantName="System.Data.SqlClient"  type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
     </providers>
    

To:

:

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

Make sure your connection username/password/db name are correct or Visual Studio may crash. (Happened with me.)

请确保您的连接用户名/密码/数据库名是正确的,否则Visual Studio可能会崩溃。(和我发生。)

#5


0  

Did you try to install the latest dot net connector for my sql ? http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html or http://dev.mysql.com/downloads/connector/net/ depending your context.

你试过为我的sql安装最新的。net连接器吗?http://dev.sqmyl.com/techresources/articles/mysql -installer-for windows s.html或http://dev.mysql.com/downloads/connector/net/取决于您的上下文。

#6


0  

2015-11-07 Update

2015-11-07更新

The bugs are fixed and you can now get it all working without editing any files or even referencing assemblies outside of NuGet. You simply have to install the right thing and add the right NuGet packages. Here's how:

bug已经修复,您现在可以在不编辑任何文件甚至不引用NuGet之外的程序集的情况下使其全部工作。您只需安装正确的东西并添加正确的NuGet包。方法如下:

Use the MySQL for Windows installer and include the Visual Studio support and the latest Connector.Net. Be sure to update after installing and you will get the latest of each (1.2.5 and 6.9.8).

Windows安装程序使用MySQL,包括Visual Studio支持和最新的Connector.Net。安装后请务必更新,您将得到最新的版本(1.2.5和6.9.8)。

Then, use NuGet to install EntityFramework, MySql.Data, and MySql.Data.Entity.

然后,使用NuGet安装EntityFramework, MySql。数据和MySql.Data.Entity。

Finally, build and enjoy code-first reverse engineering goodness by adding an Ado.Net Entity Model.

最后,通过添加Ado构建并享受代码优先反向工程的好处。净的实体模型。

#7


0  

i found this on the mySQL Bucktracker

我在mySQL Bucktracker上找到的

Try the following workaround....

尝试以下方法....

Run the following command on the MySQL DB and then try if this works.

在MySQL DB上运行以下命令,然后尝试这样做是否有效。

set global optimizer_switch='derived_merge=off'

集全球optimizer_switch = ' derived_merge =了'

I also added the following assemblies:

我还添加了以下程序集:

  • EF6 as Nuget package
  • EF6作为Nuget包
  • MySQL.Data
  • MySQL.Data
  • MySql.Data.Entity.EF6.dll
  • MySql.Data.Entity.EF6.dll
  • MySQL.Web (not sure if really needed)
  • MySQL。Web(不确定是否需要)

#8


0  

FYI for everyone using a multi-project solution, if you can't run your GUI project due to problems with finding/loading MySql EF6 provider, like:

对于使用多项目解决方案的每个人来说,如果由于查找/加载MySql EF6提供程序出现问题而无法运行GUI项目,比如:

No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.(...)'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

没有为ADO找到实体框架提供程序。具有不变量名“MySql.Data.(…)”的NET提供者。确保提供程序在应用程序配置文件的“entityFramework”部分注册。参见http://go.microsoft.com/fwlink/?LinkId = 260882的更多信息。

please see this question.

请查看这个问题。

Although it's about SqlServer the problem might be the same: if only one of your projects handles the DB operations, then most probably you added Nuget References to MySql.Data and MySql.Data.Entity and EntityFramework to that project. Since MySql.Data and EntityFramework are used directly by the code, the build process is smart enough to copy them to output folder, and to copy it second time to the GUI project's output folder as well.

虽然它是关于SqlServer的,但问题可能是相同的:如果您的一个项目处理了DB操作,那么很可能您添加了Nuget对MySql的引用。数据和MySql.Data。项目的实体和实体框架。因为MySql。数据和EntityFramework由代码直接使用,构建过程足够智能,可以将它们复制到输出文件夹,并将其第二次复制到GUI项目的输出文件夹中。

However, since MySql.Data.Entity is referred to only by the app.config or web.config text file, the build process thinks that this reference is not needed (the code does not use it!) and strips it away, and you won't see MySql.Data.Entity.EF6.dll in GUI project output dir, and this causes the GUI project to be unable to find that provider.

然而,由于MySql.Data。实体仅由app.config或web引用。配置文本文件,构建过程认为不需要这个引用(代码不使用它!)并将其删除,您将看不到MySql.Data.Entity.EF6。dll在GUI项目输出目录中,这会导致GUI项目无法找到该提供者。

So - two options - ensure that something copies that DLL there as a part of build process (i.e. pre/post build event, deployment package builder, CI task, human task, whatever), or just make a direct reference to the assembly in your DB/EF6 project.

因此——两个选项——确保某些东西将DLL作为构建过程的一部分复制到那里(例如,前/后构建事件、部署包构建器、CI任务、人工任务等等),或者直接引用DB/EF6项目中的程序集。