Reputation: 14324
I have deployed an application that uses EF to the same server as my DB. Obviously the first time I ran the app on the server the DB was created - no problems.
However, when I attempt to run the same application from my local machine using the same connection string / login details as the instance running on the server, I get this exception saying the model has changed, although it hasn't:
The model backing the 'EkmDomainsDbContext' context has changed since the database was created. Either manually delete/update the database, or call Database.SetInitializer with an IDatabaseInitializer instance. For example, the DropCreateDatabaseIfModelChanges strategy will automatically delete and recreate the database, and optionally seed it with new data.
I assume this is something to do with the EdmMetadata table, but I am not sure exactly what. Can anyone shed any light on this problem?
Upvotes: 2
Views: 101
Reputation: 1008
Existing databases do not generally need any database initializer so it can be turned off for your context type by calling:
Database.SetInitializer<YourDataContext>(null);
Upvotes: 1