Mono Entity Framework 6 MySQL

.net c# entity-framework mono mysql


Using Entity Framework 6, I created a project that uses aMySQL in the database. The project is operational on my Windows PC. I then attempted to move that project to my Linux computer. I added the to the project in order to run it.MySQL dll to the machine configuration and the GAC. The project folder includes contains all required dlls. The following error occurs when Entity Framework accesses the database:

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"?>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit -->
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    <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"/>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      <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" />

Any thoughts?

THX Michael

3/3/2014 1:10:32 PM

Popular Answer

You don't appear to have the MySql ADO.NET provider configured, which is why. Look at my blogpost on using EF6 and MySql on Mono, which demonstrates how to remedy this specific problem (note that I wrote this post for pre-release EF6 version and the issues I hit on the road should be now fixed). You must discover the appropriate entries to use for your provider because I used the DevArt MySql provider in the post. Check out this post on stackoverflow, Personalized.NET Data Providers, for more information on registering ADO.NET providers (you are most interested in DbProviderFactories part because this is what you are missing)

5/23/2017 12:34:17 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow