Ejemplo n.º 1
0
 public static string GetForeignKeyConstraintName(ForeignKeyColumn foreignKeyColumn, bool shortenNamesByRemovingVowelsFirst,
                                                  bool fixBreakBug, string defaultTableNamePrefix)
 {
     if (!string.IsNullOrEmpty(foreignKeyColumn.IndexName))
     {
         return(foreignKeyColumn.IndexName);
     }
     else
     {
         return(ShortenDatabaseName("FK" + Utils.NAME_SEPARATOR + RemoveTableNamePrefix(foreignKeyColumn.Table.TableName, foreignKeyColumn.Table.TableNamePrefix, defaultTableNamePrefix) +
                                    Utils.NAME_SEPARATOR + RemoveTableNamePrefix(foreignKeyColumn.ForeignTable.TableName, foreignKeyColumn.ForeignTable.TableNamePrefix, defaultTableNamePrefix),
                                    MAX_CONSTRAINT_NAME_CHARS, shortenNamesByRemovingVowelsFirst, fixBreakBug, null));
     }
 }
Ejemplo n.º 2
0
        public ForeignKeyColumn AddFKTable(Table fkTable)
        {
            ExceptionUtils.ThrowIfTrue(fkTable == this, "fkTable == this");
            foreach (ForeignKeyColumn testFKColumn in m_ForeignKeyColumns)
            {
                if (testFKColumn.ForeignTable == fkTable)
                {
                    return(testFKColumn);
                }
            }

            ForeignKeyColumn foreignKeyColumn =
                new ForeignKeyColumn(this, new GuidForeignKeyAttribute());

            foreignKeyColumn.ForeignTable = fkTable;
            CollectionUtils.Add(foreignKeyColumn, ref m_ForeignKeyColumns);
            m_AllColumns = m_DirectColumns = null;
            return(foreignKeyColumn);
        }