C# 单实体框架6 MySQL

C# 单实体框架6 MySQL,c#,mysql,.net,entity-framework,mono,C#,Mysql,.net,Entity Framework,Mono,我用Entity Framework 6开发了一个项目,它使用MySQL作为数据库。。在我的windows系统上,项目正在运行。现在我尝试在我的linux机器上移动该项目。 为了运行该项目,我将MySQLdll添加到GAC和机器配置中。所有需要的DLL也位于项目文件夹中。实体框架访问数据库时,出现以下错误: System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net F

我用Entity Framework 6开发了一个项目,它使用
MySQL
作为数据库。。在我的windows系统上,项目正在运行。现在我尝试在我的linux机器上移动该项目。 为了运行该项目,我将
MySQL
dll添加到GAC和机器配置中。所有需要的DLL也位于项目文件夹中。实体框架访问数据库时,出现以下错误:

System.Configuration.ConfigurationErrorsException: Failed to find or load the registered .Net Framework Data Provider.
  at System.Data.Common.DbProviderFactories.GetFactory (System.Data.DataRow providerRow) [0x00000] in <filename unknown>:0

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <connectionStrings>
    <add name="CashDeskServerContext" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;
      port=3306;database=ServerContext;uid=root;password=password;Convert Zero Datetime=True"/>
      <add name="AuditLogContext" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;
      port=3306;database=AuditLogContext;uid=root;password=password;Convert Zero Datetime=True"/>
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <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>
System.Configuration.ConfigurationErrorsException:未能找到或加载已注册的.Net Framework数据提供程序。
位于:0中的System.Data.Common.DbProviderFactorys.GetFactory(System.Data.DataRow providerRow)[0x00000]处
有什么想法吗

THX
Michael这是因为您似乎没有配置MySql ADO.NET提供程序。看一看我关于在Mono上使用EF6和MySql的文章,它展示了如何解决这个问题(注意,我写这篇文章是为了EF6的预发布版本,我在路上遇到的问题现在应该已经解决了)。请注意,在本文中,我使用了DevArt MySql提供程序,因此您必须找到用于提供程序的正确条目。还可以看看这篇stackoverflow文章,它提供了有关注册ADO.NET提供程序的详细信息(您对DbProviderFactorys最感兴趣,因为这是您所缺少的)

我不确定Mono是否完全支持EF 6。但一般来说,这是一个配置问题或版本问题。你能给我们看一下你的App.Config来查看配置吗?嗨,阿尔贝托,我在我的问题中添加了App.Config…请注意,你引用的是通常Mono不支持的EntityFramework.SqlServer。拆下这部分,please@AlbertoLeón-EF6应该在Mono上工作。我尝试了一个预发布的EF6版本,并且能够使它工作()。我遇到的问题现在应该解决了。谢谢你,波威尔。我没有将属性添加到上下文中。我修复了此问题,现在出现以下错误:System.InvalidOperationException:表“table”的配置列顺序包含重复项。确保指定的列顺序值是不同的。这是另一个问题-使用更多详细信息启动新线程。我只能怀疑您在同一个表上使用了具有相同索引值的多个
属性。