I am having a weird issue with MySql Connector(6.8.3) and EF6. I was working on a WebApi project where I use MySql and EF6 with Database first approach. Everything worked fine[even deployed on one of the test servers] until I changed the database from 'Test' database to 'Production' database [just the database name] in the connection string and updated the model[just to see nothing is broken!]. After that, it failed to connect to database. So, I changed the connection string back and rebuilt the solution, then I got bunch of 'Mapping' warnings. I deleted the model and tried to create the model again from the database. Now, I am getting the following message
Your project references the latest version of Entity Framework; however, an Entity Framework database provider compatible with this version could not be found for you data connection. Exit this wizard, install a compatible provider, and rebuild your project before performing this action
Here is the config file
<!-- 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>
<system.data>
<DbProviderFactories>
<clear/>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySql.Data.MySqlClient" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data,Version=6.8.3.0, Culture=neutral,PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<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" />
</providers>
</entityFramework>
I tried reinstalling the connector and EF from Nuget, but nothing changed. Can someone please let me know whats going on?
Thanks
I had a similar issue, I had the MySql connector referenced to my project with Nuget. But the server had another version of MySql connector installed in the machine itself. So the application gave priority to the MySql connector installed in GAC of server.
All you have to do is either
Uninstall the MySql connector in Server
or
Install suitable MySql connector (in your case v6.8.3) in server and uninstall the rest
or
change your provider type version to one that is installed in the server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With