Search This Blog

Tuesday, January 13, 2015

Entity Framework : The model backing the ‘MyDBContext’ context has changed since the database was created. Consider using Code First Migrations to update the database



The model backing the ‘MyDBContext’ context has changed since the database was created. Consider using Code First Migrations to update the database


This type of error occurred when the model and the database cannot be mapped correctly. That means there is a modification or changed in the database. We made any type of schema change on the table or database after including Entity Data Model in the project or solutions.

To solve this error writhe the following code in Application_Start() Method in Global.asax.cs file

Database.SetInitializer(null);


That means we need to bind our DB context class with a null value.

If the database schema is changed, it is mandatory to updates the .edmx file.

No comments:

Popular Posts