EF does not crosscheck the database schema with the model each time the application starts. Instead, he searches for a model that is stored in the database (__MigrationsHistory table and before EdmMetadata) and compares this saved model with the model you are using. If the models match, the database will be used. If the models do not match the exception, they will be thrown away. If your database does not have a __MigrationHistory or EdmMetadata table, EF will assume that you are using the basic Database approach with DbContext and your database is model-compliant. If you want to compare the database with your model, you can reset Edmx for your model (using EdmxWriter.WriteEdmx) and use Visual Studio and the EF constructor to get Edmx from the database and compare parts of the SSDL.
Pawel
source share