2

I've created a new ASP.Net MVC Project and added references to MySql.Data, MySql.Data.Entity, MySql.Data.Entity.EF6 and MySql.Web.v20.

I've also modified the web config and added the following:

<system.data>
<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.9.6.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
</Dbproviderfactories>
</system.data>
<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 invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, 
    EntityFramework.SqlServer" />
</providers>
</entityFramework>

However, when I try to add an ADO.Net Entity Data Model, Visual Studio doesn't pick up MySQL as a data source as shown below: enter image description here

Any ideas why this is and how I could resolve this?

Thanks

Bhav
  • 1,957
  • 7
  • 33
  • 66
  • are you using mySQL connectors? – Stefano Vuerich May 23 '15 at 17:14
  • @StefanoVuerich What do you mean by that? I am hoping to create an entity data model based on a mysql database connection. – Bhav May 23 '15 at 17:16
  • 1
    By default Visual Studio works with SQL server so to work with mysql you need some "specials" connectors. They let visual studio talk with mySQL. http://dev.mysql.com/doc/connector-net/en/connector-net-visual-studio-install.html – Stefano Vuerich May 23 '15 at 17:18
  • If you install a new Visual Studio try to reinstall drivers as well – Stefano Vuerich May 23 '15 at 17:30
  • @StefanoVuerich So I've uninstalled and re-installed the MySQL .Net Connector. Created a new MVC project. Updated EntityFramework in NuGet to 6.1.3 + added the four MySql references + added the above code to the config but that hasn't worked. – Bhav May 23 '15 at 19:25
  • did u check this post ? http://stackoverflow.com/questions/18578785/mysql-database-connection-with-visual-studio-2013-preview – Stefano Vuerich May 23 '15 at 19:55

1 Answers1

2

I uninstalled the MySQL .Net Connector and installed the latest version.

I updated Visual Studio 2013 to Update 4.

I installed the latest MySQL for Visual Studio.

I created a new ASP.Net MVC Project and added references to MySql.Data, MySql.Data.Entity.EF6 and MySql.Web.v20.

Bhav
  • 1,957
  • 7
  • 33
  • 66
  • `I installed the latest MySQL for Visual Studio.` Do you mean that you have installed the latest MySQL for Windows? – Andrei Khotko May 08 '17 at 08:32
  • 1
    @AndreiKhotko Sorry this was over a year ago and I can't remember exactly but I think it was this - https://dev.mysql.com/downloads/windows/visualstudio/ – Bhav May 08 '17 at 12:11
  • Thank you! I think it's what I need. I have the same problem now and I'm trying to solve it. I didn't expect that there will be neccessary to install this software. – Andrei Khotko May 08 '17 at 12:15