Wednesday, 18 December 2013

Context has changed since the database was created. Consider using Code First Migrations to update the database - Entity Framework - ASP.Net



This error occurs when the database is not in sync with your data model. If you enable Code First migrations then it updates the database back based on your data model. You can do this through Package Manager. In Visual Studio select Tools -> Library Package Manager -> Package Manager Console and run the following commands to enable Code First Migrations.





PM> Enable-Migrations –EnableAutomaticMigrations

PM>  Update-Database –Verbose

It does show the update logs as well to see the migration happening.
 

No comments:

Post a Comment