I’m using the new migrations in my ASP.NET MVC 4 project and within the Migrations/Configuration file I have the following:
public Configuration()
{
AutomaticMigrationsEnabled = false;
AutomaticMigrationDataLossAllowed = false;
}
In the same file file, I also have a Seed method that populates my database. I’ve noticed that every time I run my app, it reseeds the database even though the model hasn’t changed. Within my global.asax file I have the following Database Initializer in Application_Start
Database.SetInitializer(new MigrateDatabaseToLatestVersion<UtilitiesContext, Migrations.Configuration>());
I only want it to seed the database if the model changes or I run the Update-Database command. How would I go about doing that?
Actually I just removed the initializer statement all together and it worked.