This project has moved. For the latest updates, please go here.
3
Vote

"Model compatibility cannot be checked because the database does not contain model metadata" on start

description

Just downloaded and opened project, compiled (with mvc version 5), and i get on first run this error in browser:
Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations


Line 14:             using (var db = new CommandModelDatabase())
Line 15:             {
Line 16:                 var products = (from p in db.Products where p.Featured select p).Take(count).ToList();
Line 17:                 if (!products.Any())
Line 18:                     products = (from p in db.Products orderby p.StockLevel descending select p).Take(1).ToList();


Source File: \naa4e\IBuyStuff-cqrs\src\Domain\IBuyStuff.Domain.Services\Impl\CatalogService.cs   

comments

rohancragg wrote Mar 18, 2015 at 2:06 PM

I'm pretty sure I got the same issue and that deleting the database and log files in the App_Data folder resolved it (the CommandModel has an SampleAppInitializer which will re-add all the sample data).

Bastiaan7 wrote Oct 4, 2016 at 8:43 AM

I have the same error and deleting the database does not help. It will generate an other error.