Model compatibility cannot be checked Error when Created SQL Server 2008 Database

Feb 16, 2012 at 7:44 AM


I created a SQL Server Database using the script "MvcMusicStore-Create" from folder ~\MvcMusicStore-v3.0\MvcMusicStore-Assets\Data. I changed the connection string in web.config. Now I am getting the following exception in the Music Store application.

"Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions."

Could you please tell me how to correct it?

Note: I am not familiar with Entity Framework. My current intention is to learn MVC keeping all other things abstract.

Note: Installing SQL Server CE is not feasible for me.






Feb 16, 2012 at 8:16 AM


I got it working by following . Thanks to Charlie.

Steps I followed from the above are listed below:


Comment out following line in global.asax

//System.Data.Entity.Database.SetInitializer(new MvcMusicStore.Models.SampleData());


Add the following to MusicStoreEntities class

using System.Data.Entity.ModelConfiguration;

using System.Data.Entity.ModelConfiguration.Conventions;

protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)