System.ArgumentException when using MySQL with Entity framework

1

I installed the MySQL connector in the environment, I installed the MySQL references through the Nuget package. When I start the system and try to insert into the database, the following error appears:

  

The ADO.NET provider with invariant name 'MySQL Data Provider' is   either not registered in the machine or application config file, or   could not be loaded. See the inner exception for details.

     

The requested .Net Framework Data Provider could not be found.   It may not be installed.

ConnectionString:

<add name="DefaultConnection" providerName="MySQL Data Provider" connectionString="Server=localhost;Database=bananasfit;Uid=root; " />

Provider

<DbProviderFactories>
      <clear/>
      <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.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>

What could be causing this error?

    
asked by anonymous 02.09.2014 / 23:27

1 answer

3

You have failed to register the provider along with the Entity Framework:

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

Incidentally, invariantName must match the type implemented in the library:

<add name="DefaultConnection" providerName="MySql.Data.MySqlClient" connectionString="Server=localhost;Database=bananasfit;Uid=root; " />
    
02.09.2014 / 23:29