public static void Setup(Type type) { try { var items = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) .Where(type.IsAssignableFrom).Select(t => t.Assembly); var fluentConfig = FluentMappingConfiguration.Scan(s => { foreach (var item in items) { s.Assembly(item); s.WithSmartConventions(); s.TablesNamed( t => t.GetCustomAttributes(true).OfType <TableNameAttribute>().FirstOrDefault()?.Value ?? Inflector.AddUnderscores(Inflector.MakePlural(t.Name)).ToLower()); s.Columns.Named(m => Inflector.AddUnderscores(m.Name).ToLower()); s.Columns.IgnoreWhere(x => x.GetCustomAttributes <IgnoreAttribute>().Any()); s.PrimaryKeysNamed(t => Inflector.AddUnderscores(t.Name).ToLower() + "_id"); s.PrimaryKeysAutoIncremented(t => true); } }); Config = fluentConfig; } catch (ReflectionTypeLoadException) { //Swallow } }
public TableValuedFunctionsTemplateData(bool singleReturnModel, string singleReturnColumnName, string execName, string returnClassName, string writeStoredProcFunctionParamsFalse, string name, string schema, string writeTableValuedFunctionDeclareSqlParameter, string writeTableValuedFunctionSqlParameterAnonymousArray, string writeStoredProcFunctionSqlAtParams, string fromSql, string queryString, string modelBuilderCommand, string modelBuilderPostCommand, bool includeModelBuilder) { SingleReturnModel = singleReturnModel && !string.IsNullOrEmpty(singleReturnColumnName); SingleReturnColumnName = singleReturnColumnName; ExecName = execName; ReturnClassName = returnClassName; PluralReturnClassName = Inflector.MakePlural(returnClassName); WriteStoredProcFunctionParamsFalse = writeStoredProcFunctionParamsFalse; Name = name; Schema = schema; WriteTableValuedFunctionDeclareSqlParameter = writeTableValuedFunctionDeclareSqlParameter; WriteTableValuedFunctionSqlParameterAnonymousArray = writeTableValuedFunctionSqlParameterAnonymousArray; WriteStoredProcFunctionSqlAtParams = writeStoredProcFunctionSqlAtParams; FromSql = fromSql; QueryString = queryString; ModelBuilderCommand = modelBuilderCommand; ModelBuilderPostCommand = modelBuilderPostCommand; IncludeModelBuilder = includeModelBuilder; }
public void Penis_Should_Be_Pluralized_Penises() { var word = "Person"; var inflected = Inflector.MakePlural(word); Assert.Equal("People", inflected); }
/// <summary> /// Make plural when count is not one /// </summary> /// <param name="number">The number of things</param> /// <param name="sourceString">The source string.</param> /// <returns></returns> public static string Pluralize(int number, string sourceString) { if (number == 1) { return(String.Concat(number, " ", Inflector.MakeSingular(sourceString))); } return(String.Concat(number, " ", Inflector.MakePlural(sourceString))); }
public void MakePlural(string word, string expected) { // Act var result = Inflector.MakePlural(word); // Assert Assert.AreEqual(expected, result); }
public Task <bool> Process(XmlLookupWorkItem item) { var match = _lookupRegex.Match(item.LookupXElement.Name.LocalName); if (!match.Success) { return(Task.FromResult(false)); } item.ResourceName = match.Groups["TypeName"].Value; item.IdentityName = $"{item.ResourceName}Identity"; item.LookupName = $"{item.ResourceName}Lookup"; item.JsonResourceName = Inflector.MakePlural(Inflector.MakeInitialLowerCase(item.ResourceName)); item.JsonModelName = Inflector.MakeInitialLowerCase(item.ResourceName); return(Task.FromResult(true)); }
public string GetUniqueForeignKeyName(bool isParent, string tableNameHumanCase, ForeignKey foreignKey, bool checkForFkNameClashes, bool makeSingular, Relationship relationship) { // For unit testing //if (tableNameHumanCase.StartsWith("Burak") || tableNameHumanCase.StartsWith("Car") || tableNameHumanCase.StartsWith("User")) //{ // var s = $"[TestCase(\"00\", \"{foreignKey.FkTableName}\", \"{NameHumanCase}\", \"{string.Join("|",Columns.Select(c => c.NameHumanCase))}\", {isParent}, \"{tableNameHumanCase}\", {checkForFkNameClashes}, {makeSingular}, Relationship.{relationship}, \"{foreignKey.FkTableName}\", \"{foreignKey.PkTableName}\", {foreignKey.IncludeReverseNavigation}, \"{foreignKey.FkColumn}\")]{Environment.NewLine}"; // System.IO.File.AppendAllText("c:/temp/unit.txt", s); //} // User specified name if (isParent && !string.IsNullOrEmpty(foreignKey.ParentName)) { return(foreignKey.ParentName); } // User specified name if (!isParent && !string.IsNullOrEmpty(foreignKey.ChildName)) { return(foreignKey.ChildName); } // Generate name var addReverseNavigationUniquePropName = checkForFkNameClashes && (_table.DbName == foreignKey.FkTableName || (_table.DbName == foreignKey.PkTableName && foreignKey.IncludeReverseNavigation)); if (ReverseNavigationUniquePropName.Count == 0) { // Reserve table name and all column names ReverseNavigationUniquePropName.Add(_table.NameHumanCase); ReverseNavigationUniquePropName.AddRange(_table.Columns.Select(c => c.NameHumanCase)); } if (!makeSingular) { tableNameHumanCase = Inflector.MakePlural(tableNameHumanCase); } if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(tableNameHumanCase) && !ReverseNavigationUniquePropNameClashes.Contains(tableNameHumanCase)) { ReverseNavigationUniquePropNameClashes.Add(tableNameHumanCase); // Name clash } // Attempt 1 var fkName = (Settings.UsePascalCase ? Inflector.ToTitleCase(foreignKey.FkColumn) : foreignKey.FkColumn).Replace(" ", string.Empty).Replace("$", string.Empty); var name = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 1); string col; if (!ReverseNavigationUniquePropName.Contains(name) && !ReverseNavigationUniquePropNameClashes.Contains(name)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(name); foreignKey.UniqueName = name; } return(name); } if (_table.DbName == foreignKey.FkTableName) { // Attempt 2 if (fkName.ToLowerInvariant().EndsWith("id")) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 2); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 3 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 3); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 4 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 4); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Attempt 5 for (var n = 1; n < 99; ++n) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 5) + n; if (ReverseNavigationUniquePropName.Contains(col)) { continue; } if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Give up return(Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 6)); }
/// <summary> /// Singulars to plural. /// </summary> /// <param name="sourceString">The source string.</param> /// <returns></returns> public static string SingularToPlural(string sourceString) { return(Inflector.MakePlural(sourceString)); }
public void AddReverseNavigation(Relationship relationship, string fkName, Table fkTable, string propName, string constraint, List <ForeignKey> fks, Table mappingTable = null) { var fkNames = ""; switch (relationship) { case Relationship.OneToOne: case Relationship.OneToMany: case Relationship.ManyToOne: fkNames = (fks.Count > 1 ? "(" : "") + string.Join(", ", fks.Select(x => "[" + x.FkColumn + "]").Distinct().ToArray()) + (fks.Count > 1 ? ")" : ""); break; case Relationship.ManyToMany: break; } string accessModifier = fks != null && fks.FirstOrDefault() != null ? (fks.FirstOrDefault().AccessModifier ?? "public") : "public"; switch (relationship) { case Relationship.OneToOne: ReverseNavigationProperty.Add( new PropertyAndComments() { AdditionalDataAnnotations = Settings.ForeignKeyAnnotationsProcessing(fkTable, this, propName, string.Empty), Definition = string.Format("{0} {1}{2} {3} {{ get; set; }}{4}", accessModifier, GetLazyLoadingMarker(), fkTable.NameHumanCaseWithSuffix(), propName, Settings.IncludeComments != CommentsStyle.None ? " // " + constraint : string.Empty), Comments = string.Format("Parent (One-to-One) {0} pointed by [{1}].{2} ({3})", NameHumanCaseWithSuffix(), fkTable.Name, fkNames, fks.First().ConstraintName) } ); break; case Relationship.OneToMany: ReverseNavigationProperty.Add( new PropertyAndComments() { AdditionalDataAnnotations = Settings.ForeignKeyAnnotationsProcessing(fkTable, this, propName, string.Empty), Definition = string.Format("{0} {1}{2} {3} {{ get; set; }}{4}", accessModifier, GetLazyLoadingMarker(), fkTable.NameHumanCaseWithSuffix(), propName, Settings.IncludeComments != CommentsStyle.None ? " // " + constraint : string.Empty), Comments = string.Format("Parent {0} pointed by [{1}].{2} ({3})", NameHumanCaseWithSuffix(), fkTable.Name, fkNames, fks.First().ConstraintName) } ); break; case Relationship.ManyToOne: string initialization1 = string.Empty; if (Settings.UsePropertyInitializers) { initialization1 = string.Format(" = new {0}<{1}>();", Settings.CollectionType, fkTable.NameHumanCaseWithSuffix()); } ReverseNavigationProperty.Add( new PropertyAndComments() { AdditionalDataAnnotations = Settings.ForeignKeyAnnotationsProcessing(fkTable, this, propName, string.Empty), Definition = string.Format("{0} {1}{2}<{3}> {4} {{ get; set; }}{5}{6}", accessModifier, GetLazyLoadingMarker(), Settings.CollectionInterfaceType, fkTable.NameHumanCaseWithSuffix(), propName, initialization1, Settings.IncludeComments != CommentsStyle.None ? " // " + constraint : string.Empty), Comments = string.Format("Child {0} where [{1}].{2} point to this entity ({3})", Inflector.MakePlural(fkTable.NameHumanCase), fkTable.Name, fkNames, fks.First().ConstraintName) } ); ReverseNavigationCtor.Add(string.Format("{0} = new {1}<{2}>();", propName, Settings.CollectionType, fkTable.NameHumanCaseWithSuffix())); break; case Relationship.ManyToMany: string initialization2 = string.Empty; if (Settings.UsePropertyInitializers) { initialization2 = string.Format(" = new {0}<{1}>();", Settings.CollectionType, fkTable.NameHumanCaseWithSuffix()); } ReverseNavigationProperty.Add( new PropertyAndComments() { AdditionalDataAnnotations = Settings.ForeignKeyAnnotationsProcessing(fkTable, this, propName, string.Empty), Definition = string.Format("{0} {1}{2}<{3}> {4} {{ get; set; }}{5}{6}", accessModifier, GetLazyLoadingMarker(), Settings.CollectionInterfaceType, fkTable.NameHumanCaseWithSuffix(), propName, initialization2, Settings.IncludeComments != CommentsStyle.None ? " // Many to many mapping" : string.Empty), Comments = string.Format("Child {0} (Many-to-Many) mapped by table [{1}]", Inflector.MakePlural(fkTable.NameHumanCase), mappingTable == null ? string.Empty : mappingTable.Name) } ); ReverseNavigationCtor.Add(string.Format("{0} = new {1}<{2}>();", propName, Settings.CollectionType, fkTable.NameHumanCaseWithSuffix())); break; default: throw new ArgumentOutOfRangeException("relationship"); } }
public string GetUniqueColumnName(string tableNameHumanCase, ForeignKey foreignKey, bool checkForFkNameClashes, bool makeSingular, Relationship relationship) { var addReverseNavigationUniquePropName = (checkForFkNameClashes || Name == foreignKey.FkTableName || (Name == foreignKey.PkTableName && foreignKey.IncludeReverseNavigation)); if (ReverseNavigationUniquePropName.Count == 0) { ReverseNavigationUniquePropName.Add(NameHumanCase); ReverseNavigationUniquePropName.AddRange(Columns.Select(c => c.NameHumanCase)); } if (!makeSingular) { tableNameHumanCase = Inflector.MakePlural(tableNameHumanCase); } if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(tableNameHumanCase) && !ReverseNavigationUniquePropNameClashes.Contains(tableNameHumanCase)) { ReverseNavigationUniquePropNameClashes.Add(tableNameHumanCase); // Name clash } // Attempt 1 string fkName = (Settings.UsePascalCase ? Inflector.ToTitleCase(foreignKey.FkColumn) : foreignKey.FkColumn).Replace(" ", "").Replace("$", ""); string name = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 1); string col; if (!ReverseNavigationUniquePropNameClashes.Contains(name) && !ReverseNavigationUniquePropName.Contains(name)) { if (addReverseNavigationUniquePropName) { ReverseNavigationUniquePropName.Add(name); } return(name); } if (Name == foreignKey.FkTableName) { // Attempt 2 if (fkName.ToLowerInvariant().EndsWith("id")) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 2); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropNameClashes.Contains(col) && !ReverseNavigationUniquePropName.Contains(col)) { if (addReverseNavigationUniquePropName) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 3 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 3); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropNameClashes.Contains(col) && !ReverseNavigationUniquePropName.Contains(col)) { if (addReverseNavigationUniquePropName) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 4 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 4); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropNameClashes.Contains(col) && !ReverseNavigationUniquePropName.Contains(col)) { if (addReverseNavigationUniquePropName) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Attempt 5 for (int n = 1; n < 99; ++n) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 5) + n; if (ReverseNavigationUniquePropName.Contains(col)) { continue; } if (addReverseNavigationUniquePropName) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Give up return(Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 6)); }
public TableTemplateData(Table table) { Table = table; DbSetName = table.NameHumanCaseWithSuffix(); DbSetConfigName = table.NameHumanCaseWithSuffix() + Settings.ConfigurationClassName; PluralTableName = !string.IsNullOrWhiteSpace(table.PluralNameOverride) ? table.PluralNameOverride : Inflector.MakePlural(table.NameHumanCase); DbSetModifier = table.DbSetModifier; Comment = Settings.IncludeComments == CommentsStyle.None ? string.Empty : " // " + table.DbName; DbSetPrimaryKeys = string.Join(", ", table.PrimaryKeys.Select(x => "\"" + x.NameHumanCase + "\"")); }
public static void WithSmartConventions(this IConventionScanner scanner) { scanner.PrimaryKeysNamed(y => y.Name + "Id"); scanner.TablesNamed(y => Inflector.MakePlural(y.Name)); scanner.Columns.IgnoreComplex(); }
/// <summary> /// Collections the names are camel cased and plural. /// </summary> /// <returns></returns> public AutoMappingProfileBuilder CollectionNamesAreCamelCasedAndPlural() { _profile.Conventions.CollectionNameConvention = new DelegateCollectionNameConvention(t => Inflector.MakePlural(Inflector.ToCamelCase(t.Name))); return(this); }
public static string SingularToPlural(string sIn) { return(Inflector.MakePlural(sIn)); }
public void SetUp() { var types = new[] { typeof(User), typeof(ExtraUserInfo), typeof(UserWithExtraInfo), typeof(Usersss), typeof(House), typeof(Supervisor) }; var dbFactory = new DatabaseFactory(); //DatabaseFactory.ColumnSerializer = new JsonNetColumnSerializer(); var config = FluentMappingConfiguration.Scan(s => { s.Assembly(typeof(User).GetTypeInfo().Assembly); s.IncludeTypes(types.Contains); s.PrimaryKeysNamed(y => ToLowerIf(y.Name + "Id", false)); s.TablesNamed(y => ToLowerIf(Inflector.MakePlural(y.Name), false)); s.Columns.Named(x => ToLowerIf(x.Name, false)); s.Columns.ForceDateTimesToUtcWhere(x => x.GetMemberInfoType() == typeof(DateTime) || x.GetMemberInfoType() == typeof(DateTime?)); s.Columns.ResultWhere(y => ColumnInfo.FromMemberInfo(y).ResultColumn); s.OverrideMappingsWith(new FluentMappingOverrides()); s.OverrideMappingsWith(new OneToManyMappings()); }); dbFactory.Config().WithFluentConfig(config); var configuration = new ConfigurationBuilder() .AddJsonFile("config.json") .Build(); var testDBType = Convert.ToInt32(configuration.GetSection("TestDBType").Value); switch (testDBType) { case 1: // SQLite In-Memory TestDatabase = new InMemoryDatabase(); Database = dbFactory.Build(new Database(TestDatabase.Connection)); break; case 2: // SQL Local DB case 3: // SQL Server var dataSource = configuration.GetSection("TestDbDataSource").Value; TestDatabase = new SQLLocalDatabase(dataSource); Database = dbFactory.Build(new Database(TestDatabase.Connection, new SqlServer2008DatabaseType())); break; case 4: // SQL CE case 5: // MySQL case 6: // Oracle case 7: // Postgres Assert.Fail("Database platform not supported for unit testing"); return; #if !DNXCORE50 case 8: // Firebird TestDatabase = new FirebirdDatabase(); var db = new Database(TestDatabase.Connection, new FirebirdDatabaseType()); db.Mappers.Insert(0, new FirebirdDefaultMapper()); Database = dbFactory.Build(db); break; #endif default: Assert.Fail("Unknown database platform specified"); return; } InsertData(); }
public string GetUniqueForeignKeyName(bool isParent, string tableNameHumanCase, ForeignKey foreignKey, bool checkForFkNameClashes, bool makeSingular, Relationship relationship) { var userSpecifiedName = CheckForUserSpecifiedName(isParent, foreignKey); if (!string.IsNullOrEmpty(userSpecifiedName)) { return(userSpecifiedName); } var addReverseNavigationUniquePropName = checkForFkNameClashes && (_table.DbName == foreignKey.FkTableName || (_table.DbName == foreignKey.PkTableName && foreignKey.IncludeReverseNavigation)); // Generate name if (ReverseNavigationUniquePropName.Count == 0) { // Reserve table name and all column names ReverseNavigationUniquePropName.Add(_table.NameHumanCase); ReverseNavigationUniquePropName.AddRange(_table.Columns.Select(c => c.NameHumanCase)); } if (!makeSingular) { tableNameHumanCase = Inflector.MakePlural(tableNameHumanCase); } if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(tableNameHumanCase) && !ReverseNavigationUniquePropNameClashes.Contains(tableNameHumanCase)) { ReverseNavigationUniquePropNameClashes.Add(tableNameHumanCase); // Name clash } // Attempt 1 var fkName = (Settings.UsePascalCase ? Inflector.ToTitleCase(foreignKey.FkColumn) : foreignKey.FkColumn).Replace(" ", string.Empty).Replace("$", string.Empty); var name = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 1); string col; if (!ReverseNavigationUniquePropName.Contains(name) && !ReverseNavigationUniquePropNameClashes.Contains(name)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(name); foreignKey.UniqueName = name; } return(name); } if (_table.DbName == foreignKey.FkTableName) { // Attempt 2 if (fkName.Length > 2 && fkName.ToLowerInvariant().EndsWith("id")) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 2); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 3 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 3); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } } // Attempt 4 col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 4); if (checkForFkNameClashes && ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { ReverseNavigationUniquePropNameClashes.Add(col); // Name clash } if (!ReverseNavigationUniquePropName.Contains(col) && !ReverseNavigationUniquePropNameClashes.Contains(col)) { if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Attempt 5 for (var n = 1; n < 99; ++n) { col = Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 5) + n; if (ReverseNavigationUniquePropName.Contains(col)) { continue; } if (addReverseNavigationUniquePropName || !checkForFkNameClashes) { ReverseNavigationUniquePropName.Add(col); } return(col); } // Give up return(Settings.ForeignKeyName(tableNameHumanCase, foreignKey, fkName, relationship, 6)); }
private string GetTableName() { return(Inflector.MakePlural(typeof(TEntity).Name)); }