EntityFramework 6 Alpha 2 & MySQL Connector/NET 6.6.4

entity-framework entity-framework-6 mysql mysql-connector

Question

The 6.6.4 MySQL .NET connector apparently has support for EF6. I've upgraded from EF5 and .NET 4 to EF6 alpha2 and .NET 4.5. I've recreated the ADO.NET Entity Data Model since upgrading.

Upon doing anything to the database it throws up an exception message saying;

ItemModel.ssdl(2,2) : error 0152: No Entity Framework provider found for 'MySql.Data.MySqlClient' ADO.NET provider. 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.

Currently my app.config file contains;

<?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>
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<connectionStrings>
    <add name="ItemEntities" connectionString="metadata=res://*/ItemModel.csdl|res://*/ItemModel.ssdl|res://*/ItemModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=user;password=password;persist security info=True;database=Item_dbo&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Is there a configuration item I'm legitimately missing in my app.config, or am I simply using a version of the MySQL connector and EF alpha that are simply not compatible with each other yet?

My intent is to get this running under mono 3.0.3 when this has proven successful on windows.

Popular Answer

simple add this to your web.config

  <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.6.4.0" />
    </DbProviderFactories>
  </system.data>

  <entityFramework>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.4.0" >
      </provider>
    </providers>
  </entityFramework>

but i don't think you can use 6.6.4 with EF6...




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why