5

I am developing winform application using entityframework in visual studio 2012 with database first approach. Suddenly I am facing the following error:-

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

Can any please immediately help me to resolve this issue. I shall be very thankful for timely help.

Thanks.

user3004110
  • 929
  • 10
  • 24
  • 36
  • possible duplicate of [Entity Framework Code Only error: the model backing the context has changed since the database was created](http://stackoverflow.com/questions/3552000/entity-framework-code-only-error-the-model-backing-the-context-has-changed-sinc) – Gustav Bertram Feb 28 '14 at 09:36

1 Answers1

6

make sure that you don't have a database initialized. Only have to call it once so you could put it in a static constructor of your DbContext class

Database.SetInitializer<YourDbContext>(null);
Olav Nybø
  • 11,454
  • 8
  • 42
  • 34
  • Could you explain a bit more why the line is needed later on but not at the very first attempt to do something with the DB? How can I "reset" the DB so that I won't have to execute the line you've provided? – Konrad Viltersten Apr 13 '14 at 10:05