Thursday, August 25, 2016

The model backing the 'DataContext' context has changed since the database was created. Consider using Code First Migrations to update the database





I ran into this error message:
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration Electra1' again.

After a lot of researching and troubleshooting updating tables and updating values, I realized what the issue was. What I had done was update the Entity framework prior to running a new migration from another developer. I never actually updated the database though. So when I ran the migration from another developer, I received the above error message. To fix this, I ended up migrating my changes, and updated my database. So the real issue was I had to run my migration, and update the database.

The following link was the most beneficial after all of the research.
https://msdn.microsoft.com/en-us/data/jj591621.aspx

No comments: