Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the same DbCompiledModel to create contexts against different types of database servers is not supported

Tags:

I am learning ASP.NET MVC from tutorials of Microsoft :

http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/accessing-your-model's-https://stackoverflow.com/editing-helpdata-from-a-controller

At the link above mentioned, while adding a controller named "MoviesController" , i am getting this error

"Unable to retreive metadata for 'MvcMovie.Models.Movie'. Using the same DbCompiledModel to create contexts against different types of database servers is not supported. Instead, create a separate DbCompiledModel for each type of server being used"

How can i fix that?

like image 295
Nomi Khan Avatar asked Sep 13 '12 16:09

Nomi Khan


1 Answers

I had the same issue.

I switched providerName="System.Data.SqlServerCe.4.0" with providerName="System.Data.SqlClient", and it created the Controller and Views.

I found this: http://msdn.microsoft.com/en-US/library/ms171861.aspx

I followed the directions and added a reference to SQL Server Compact, but it still doesn't work.

I also tried commenting out the default SQL Server Express connection, but it still gave the same error when trying to add the controller.

I'm just going to use SQL Server Express. I will let you know if I have any issues.

like image 118
hyperGeoMetric Avatar answered Oct 26 '22 09:10

hyperGeoMetric