MVC4 + Entity Framework 4.4 + MySql + POCO/Code First
I\'m setting up the above configuration .. here are my classes:
namespace BTD.
Using VS 2013, MySQL Connector/NET 6.9.6, Entity Framework 6, Web API 2.2 and MySQL server 5.7 I had to combine the answers to prevent the error about "Unable to retrieve metadata".
To successfully add a controller to a .NET project that uses a MySQL connection, do the following:
System.Data.SqlClient as the providerName, and comment the one for MySQL. It doesn't matter whether the connection string is valid.MySqlEFConfiguration isn't enabled in any way.About the second point, the MySQL documentation on using Connector/NET with EF6 states three possible ways to enable the MySqlEFConfiguration. Ensure that none of these are enabled while adding controllers using the VS template.
- Adding the DbConfigurationTypeAttribute on the context class:
[DbConfigurationType(typeof(MySqlEFConfiguration))]
Calling DbConfiguration.SetConfiguration(new MySqlEFConfiguration()) at the application startup
Set the DbConfiguration type in the configuration file: