For my surprise, using the CreateDatabaseIfNotExists context initializer, the line
context.Database.Initialize(true)
doesn't throw an exception if the schema does not match my code first schema.
Is there a way to validate if the current database matches our schema before, for instance, we try to access a entity, whose table doesn't exist on the database anymore, and an exception is thrown by EF?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…