Recently with MVC+EF study encountered modified model and the database did not update the error, on the Internet to find about the data migration automatically update the database, tossing the most of the day finally get out
Step one: In the Package Manager console: Enable-migrations-projectname the name of the project where EF is located
Second step: After running, the Migrations folder will be generated in the field, Migrations->configuration.cs class to change the automaticmigrationsenabled to True (that is, set as model has changed automatically update the database)
Add automaticmigrationdatalossallowed = True if you have deleted fields (you can accept data loss values during automatic migration)
Step three: In the Owndbcontext.
Public owndbcontext () Base ("defaultconnection") { Database.setinitializer (new Migratedatabasetolatestversion<owndbcontext, Own.model.migrations.configuration>()); }
PS: Some of the information in the check some of the third step, but I do not change this or the error changed to be able to
EF modifies model Automatic Update database