MySql Connector with EF 6

一笑奈何 提交于 2019-12-05 08:33:43

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.

Bloody hell, had the same issue.

I'm pretty new to the .NET environment so, I don't know how the packages manager and all work but it seems that when I import the assemblies for the MySQL connector, it updates the "web.conf" file with the wrong parameters for the provider.

In my case, using EF6 and MySQL Connector for EF v6.8.3.0, the following worked for me :

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
        <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"></provider>
    </providers>
</entityFramework>

Hope it helps someone

i know what the problem is, you have to do the next steps : 1. Right click on the project 2. Manage NuGet Packages 3.remove the MySql.Data 4.now you can do what you wanted to do 5.after you finish, go back to Manage NuGet Packages and add MySql.Data.Entity :)

good luck nofar eliasi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!