레이블이 Error인 게시물을 표시합니다. 모든 게시물 표시
레이블이 Error인 게시물을 표시합니다. 모든 게시물 표시

2013년 10월 15일 화요일

The model backing the 'DbConnection' context has changed since the database was created. Consider using Code First Migrations to update the database

Server Error in '/' Application.

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


해결방법
위와 같은 에러메세지가 출력되면 Global.asax.cs의 Application_Start()에 다음 코드를 추가하면 된다.

Database.SetInitializer<YourDbConnection>(null);

 
protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    // Use LocalDB for Entity Framework by default
    Database.DefaultConnectionFactory = new SqlConnectionFactory(@"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");
    Database.SetInitializer<NihConnection>(null);
    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);
}