0

As mentioned, I have to configure two database which are MSSQL and MYSQL. For MSSQL case, it works but now I have to add new database (MySQL) but face this question below

The type 'MySql.Data.MySqlClient.MySqlConfiguration' does not inherit from 'System.Data.Entity.DbConfiguration'. 
Entity Framework code-based configuration classes must inherit from 'System.Data.Entity.DbConfiguration'.

For my app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.26.0" newVersion="8.0.26.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient"></remove>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.26.0" />
    </DbProviderFactories>
  </system.data>
</configuration>
Steven Yu
  • 135
  • 1
  • 12

1 Answers1

0

Based on this XML:

<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />

It appears that you may have installed the MySql.Data.Entity.EF6 NuGet package. That package is no longer supported and is not compatible with MySql.Data 8.0.26.

Uninstall it, and install MySql.Data.EntityFramework instead.

(Or if you installed MySql.Data.Entity, then note that it is also not compatible, as per my answer here. Again, uninstall and replace with MySql.Data.EntityFramework.)

Bradley Grainger
  • 27,458
  • 4
  • 91
  • 108