/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IModel Create(DatabaseModel databaseModel, bool useDatabaseNames) { Check.NotNull(databaseModel, nameof(databaseModel)); var modelBuilder = new ModelBuilder(new ConventionSet()); _tableNamer = new CSharpUniqueNamer <DatabaseTable>( useDatabaseNames ? (Func <DatabaseTable, string>)(t => t.Name) : t => _candidateNamingService.GenerateCandidateIdentifier(t), _cSharpUtilities, useDatabaseNames ? (Func <string, string>)null : _pluralizer.Singularize); _dbSetNamer = new CSharpUniqueNamer <DatabaseTable>( useDatabaseNames ? (Func <DatabaseTable, string>)(t => t.Name) : t => _candidateNamingService.GenerateCandidateIdentifier(t), _cSharpUtilities, useDatabaseNames ? (Func <string, string>)null : _pluralizer.Pluralize); _columnNamers = new Dictionary <DatabaseTable, CSharpUniqueNamer <DatabaseColumn> >(); _useDatabaseNames = useDatabaseNames; VisitDatabaseModel(modelBuilder, databaseModel); return(modelBuilder.Model); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual IModel Create(DatabaseModel databaseModel, ModelReverseEngineerOptions options) { Check.NotNull(databaseModel, nameof(databaseModel)); Check.NotNull(options, nameof(options)); var modelBuilder = new ModelBuilder(); _tableNamer = new CSharpUniqueNamer <DatabaseTable>( options.UseDatabaseNames ? (Func <DatabaseTable, string>)(t => t.Name) : t => _candidateNamingService.GenerateCandidateIdentifier(t), _cSharpUtilities, options.NoPluralize ? (Func <string, string>)null : _pluralizer.Singularize); _dbSetNamer = new CSharpUniqueNamer <DatabaseTable>( options.UseDatabaseNames ? (Func <DatabaseTable, string>)(t => t.Name) : t => _candidateNamingService.GenerateCandidateIdentifier(t), _cSharpUtilities, options.NoPluralize ? (Func <string, string>)null : _pluralizer.Pluralize); _columnNamers = new Dictionary <DatabaseTable, CSharpUniqueNamer <DatabaseColumn> >(); _options = options; VisitDatabaseModel(modelBuilder, databaseModel); return(modelBuilder.Model); }