Last post Mar 10, 2015 08:11 AM by Careed
Mar 10, 2015 07:38 AM|olivesuja|LINK
I have developed an application using EF code first approach.
public class TPDatabaseInitializer : DropCreateDatabaseIfModelChanges<TPContext>
I have used the DropcreateadatabaseIfmodel changes type of initializer. When I deploy to the staging server. I can create the database with no problem.(Now it is an empty database)
Now I backed up the local Database and restore it on to Staging Server as it has data in it. I get this error on 'db.Database.Initialize' after I restore my local db copy on the server.
How do I import the data from locally to the server? Any ideas?
Model compatibility cannot be checked because the database does not contain model metadata. Model compatibility can only be checked for databases created using Code First or Code First Migrations.
Mar 10, 2015 08:11 AM|Careed|LINK
Either the metadata associated with code migration history is missing or out of date.
I would strongly recommend that you remove the initializer from your code if you believe that you have a stable database structure. The use of the initializer may end up in you destroying your database because some inadvertent change was made to the EF
By removing the initialization code, as long as the objects are properly mapped to the database, you should experience any issues.