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);

 
  1. protected void Application_Start()
  2. {
  3. AreaRegistration.RegisterAllAreas();
  4.  
  5. // Use LocalDB for Entity Framework by default
  6. Database.DefaultConnectionFactory = new SqlConnectionFactory(@"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True");
  7. Database.SetInitializer<NihConnection>(null);
  8. RegisterGlobalFilters(GlobalFilters.Filters);
  9. RegisterRoutes(RouteTable.Routes);
  10. }

댓글 없음:

댓글 쓰기