How to fix The model backing the context has changed since the database was created error How to fix The model backing the context has changed since the database was created error

How to fix The model backing the context has changed since the database was created error

The Problem

You are coding away, and you get the following error

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

This is my most frequent error when programming with Entity Framework asp.net .net mvc.  I usually only happens when using databases I do not have control over.

The Cause

Read this very good page for more info.

The Solution

Just add in this bit of code to your Application_Start() in Global.asax

Database.SetInitializer<MyContext>(null);

And you’re all set.

 

Written By Steve French

 

6 responses to “How to fix The model backing the context has changed since the database was created error”

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.