Question

I have been developing a Code First database via migrations for a couple of weeks. I added a few tables yesterday and got the error

The model backing the 'DanceDb' context has changed since the database was created.

After trying a couple of things I dropped the database, removed all code migrations, cleaned the solution, added a single migration and ran an Update-Database but I still get the same error.

If I run Add-Migrations again, nothing is generated so something thinks they're the same.

I'm running VS2013. I have two projects, one for the entities and the other for the MVC project. I've read about moving the entities into the main project but that sounds like a backwards solution if I've ever heard one.

What on earth do I do to get this running again?

Was it helpful?

Solution

A work around is to set the database initializer to null

public class DanceDb : DbContext
{
    public DanceDb() : base("name=DanceEntities")
    {
        Database.SetInitializer<DanceDb>(null);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top