Home >Database >Mysql Tutorial >Why does MVC4 fail to retrieve metadata for a MySQL model and how can I fix it?
Unable to Retrieve Metadata for MVC4 Model with MySQL
Problem:
In an MVC4 application using Entity Framework 4.4 and MySQL, an error occurs when adding a controller for a model class due to an inability to retrieve metadata for the model. The error message states that using the same compiled model to create a context for different types of database servers is not supported.
Solution:
To resolve this issue, the recommended approach is to use a separate compiled model for each database server type. However, in this specific case, a workaround has been discovered.
Workaround:
This workaround seems to trick MVC4 into recognizing the MySQL connection string properly. It is advised to use the correct provider name in the connection strings for each database type.
The above is the detailed content of Why does MVC4 fail to retrieve metadata for a MySQL model and how can I fix it?. For more information, please follow other related articles on the PHP Chinese website!