Last post Jul 23, 2014 03:01 AM by Shawn - MSFT
Jul 19, 2014 10:17 AM|nagarjunareddy04|LINK
I am using Web API and EF6 CodeFirst migrations. My model is in a separate project from my web api and I keep getting this error when trying to access the model classes. I have automatic migrations already enabled. I can drop the entire database and then
using update-database to regenerate everything I still get this error. The error is wrong because the context has not changed since I created the database. In my web api, I can reference the same Model project, access the model classes and data. I have the
Model separate from the web api project because I need to be able to reuse the Model outside of the web.
The model backing the "xx" context has changed since the database was created. Consider using Code First Migrations to update the database
Jul 22, 2014 04:02 AM|Shawn - MSFT|LINK
When we work in Entity Framework sometimes we find the error: "XX" context has changed since the database was created. Consider using Code First Migrations to update the database", it's a most frequent error when we work with Entity Framework.
This type of error occurred when the model and the database cannot be mapped correctly. That means there is a modification or changed in database.
To solve this error writhe the following code in Application_Start() Method in Global.asax.cs file
That means we need to bind our DB context class with a null value.
Jul 22, 2014 04:32 AM|nagarjunareddy04|LINK
I tried this but no use..
Jul 23, 2014 03:01 AM|Shawn - MSFT|LINK
I am not quite sure what you have tried. Did you change the context with your own CustomerDBContext? You could refer to the following information:
Besides, if the above method still can not work, please refer to the below information: