Enable Automatic Migrations in EF Code-First C#
28-12-2015 18:50:42
C# / Entity Framework
0 Bookmark(s)
326 View(s)
Unable to apply pending changes because automatic migration is disabled. To enable automatic
migration, ensure that DbMigrationsConfiguration.AutomaticMigrationsEnabled is set to true.
You can get around it by either create a migration and run it:
PM> Add-Migration Initial
followed by
PM> Update-Database
Or enable automatic migrations in code:
internal sealed class Configuration : DbMigrationsConfiguration
{
public Configuration()
{
AutomaticMigrationsEnabled = true;
AutomaticMigrationDataLossAllowed = true;
}
}