private DbModel Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo) { DebugCheck.NotNull(providerManifest); DebugCheck.NotNull(providerInfo); var schemaVersion = _modelBuilderVersion.GetEdmVersion(); var modelBuilderClone = Clone(); var model = new DbModel( new DbDatabaseMapping() { Model = EdmModel.CreateConceptualModel(schemaVersion), Database = EdmModel.CreateStoreModel(providerInfo, providerManifest, schemaVersion) }, modelBuilderClone); model.ConceptualModel.Container.AddAnnotation(XmlConstants.UseClrTypesAnnotationWithPrefix, "true"); _conventionsConfiguration.ApplyModelConfiguration(_modelConfiguration); _modelConfiguration.NormalizeConfigurations(); MapTypes(model.ConceptualModel); _modelConfiguration.Configure(model.ConceptualModel); _conventionsConfiguration.ApplyConceptualModel(model); model.ConceptualModel.Validate(); model = new DbModel( model.ConceptualModel.GenerateDatabaseMapping(providerInfo, providerManifest), modelBuilderClone); // Run the PluralizingTableNameConvention first so that the new table name is available for configuration _conventionsConfiguration.ApplyPluralizingTableNameConvention(model); _modelConfiguration.Configure(model.DatabaseMapping, providerManifest); _conventionsConfiguration.ApplyStoreModel(model); _conventionsConfiguration.ApplyMapping(model.DatabaseMapping); model.StoreModel.Validate(); return(model); }