Tuesday 15 April 2014

EE (MVC5) - How to fix error The model backing the 'CompanyDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

Error: The model backing the 'CompanyDBContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

Watch solution on YouTube:



- error displayed once updated my context class

to resolve add the following to your Global.asax.cs file
using System.Data.Entity;
using MVCCrud.Models;  // where MVCCrud is the name of my application

than in  protected void Application_Start()  add the following
  Database.SetInitializer<CompanyDBContext>(new DropCreateDatabaseIfModelChanges<CompanyDBContext>());













where CompanyDBContext is the name of my context method

No comments:

Post a Comment