Problem While running a unit test method that tests the Controller action method that access the database, we get following error.
The model backing the '' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269). Solution
The solution of this problem is to add following line into the constructor of DbContext class
System.Data.Entity.Database.SetInitializer<Models.MyContext>(null); So the typical DbContext code looks like below
public MyContext():base("name=MyConnectionString")
{
System.Data.Entity.Database.SetInitializer<Models.MyContext>(null);
}
Hope this helps.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com