Issue: After migrating the database using the Entity Framework, each time you modify the code (not the Model code), the error is:
Models that support the "Xxxdbcontext" context have changed since the database was created. Consider migrating the update database (http://go.microsoft.com/fwlink/?LinkId=238269) using Code first.
At this point the migration code generated by the execution of add-migration is empty. So re-update-database, the result is no pending explicit migrations.
However, this is not an error, but every time to modify the code to update-database. Very strange, debugging for a long time did not find out where the problem, so suspect is the Entity framework of the bug, read the source code of the Entity Framework, found that reading does not understand, the level is too limited.
So I looked it up online and there was a solution:
Database.setinitializer<dbcontext> (NULL);
It would be nice to put the above sentence in the Application_Start (), but it feels like it's not a fundamental way to solve the problem.
Finally, accidentally found this article on the StackOverflow, the original is indeed the entity Framework 6.0.0 bug. So the upgrade to 6.1.0, the problem is gone.
Troubled the N-day problem finally solved, the mood is big cool!
Ext.: http://blog.csdn.net/wmzy1067111110/article/details/25333363?reload
After migrating the database using the Entity Framework, the error is corrected every time the code is modified (not the model code).