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 |
This is working fine. thanks for this post.
useful for MVC learner
Thanks it worked
good job man i think you can use this code too
Database.SetInitializer(new DropCreateDatabaseIfModelChanges());
Thank it worked fine.
Thank you very much! You saved me a day of work!
Thank you very much 🙂 It’s working .