实体框架向导在 MySQL 上崩溃

Entity Framework wizard crashes on MySQL(实体框架向导在 MySQL 上崩溃)
本文介绍了实体框架向导在 MySQL 上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题类似于,典型的崩溃原因是 MySQL 连接器和 MySQL.Data.Entity 的版本不匹配.

您得到错误版本的最可能原因是包名从 MySQL.Data.Entity 更改为 MySql.Data.EntityFramework.

我花了很多时间来尝试线程中的答案,所以仅供参考.

My question is similar to this one but the crash happens later. I must interoperate an EF database-first model between SQL Server and MySQL. More specifically, my application had plain SQL queries fired to either SQL Server or MySQL according to connection string and configuration setting (DB_TYPE=MYSQL, etc.), having both databases with same structure and maintained together, so that each modification to one's schema was reapplied to the other.

Now I added EF support to the application using SQL Server database-first model. I must now let the application run on MySQL too. In order to verify that the old developer didn't leave something disaligned between the two DBMSes, I tried to Update model against database* and this time I selected the MySQL connection to my development database on localhost.

After I click Next on the screen below, it will simply crash and return to EDMX editor

I need to go ahead with the project, I'm stuck on this since a while.

Here is my Web.config fragment:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>

How can I solve my problem? I reinstalled MySQL tools for Visual Studio but didn't help.

*I use a localized version of Visual Studio, so I don't know the original English for all commands

解决方案

It has been answered in another thread, the typical crash reason is the mismatched versions of MySQL connector and MySQL.Data.Entity.

And most likely reason for you to get the wrong version is because of the package name changed from MySQL.Data.Entity to MySql.Data.EntityFramework.

I was spending a lot of time on trying the answers in the thread, so just FYI.

这篇关于实体框架向导在 MySQL 上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)