System.Argumentexception when using Mysql with Entity framework

Asked

Viewed 1,355 times

1

I installed Mysql Connect in the environment, installed Mysql references through Nuget package. When I start the system and try to make an entry in 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.

Unable to locate the requested Data Provider . Net Framework. Maybe he’s not 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 may be causing this mistake?

1 answer

3

Failed to register with Entity Framework:

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

Incidentally, the invariantName needs to match the type implemented in the library:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.