I'm trying to learn ASP.NET MVC so I'm following the Music Store tutorial on the asp.net website.
I'm at the part where you create the StoreManagerController using Album.cs as the model class and MusicStoreEntities.cs as the data context class.
The error when I create the Controller is: Unable to retrieve metadata for 'MvcMusicStore.Models.Album'. 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.
Sounds like I'm using two different databases, but here is my connection string section from Web.config:
<connectionStrings>
<add name="MusicStoreEntities" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=|DataDirectory|\MvcMusicStore.sdf"/>
</connectionStrings>
The odd thing is if I comment out the MusicStoreEntities connection string and then try to create the StoreManagerController it works. It also works if I change the Target Framework in the solution settings to .NET Framework 4, opening the solution in Visual Studio 2010, and then creating the Controller.
So is it an issue with Visual Studio 2012 or the connection string? Maybe some compatibility issue with CE4.0 and VS2012?