Пример #1
0
 public static string GetPrimaryKeyConstraintName(PrimaryKeyColumn primaryKeyColumn, bool shortenNamesByRemovingVowelsFirst,
                                                  bool fixBreakBug, string defaultTableNamePrefix)
 {
     if (!string.IsNullOrEmpty(primaryKeyColumn.IndexName))
     {
         return(primaryKeyColumn.IndexName);
     }
     else
     {
         return(ShortenDatabaseName("PK_" + RemoveTableNamePrefix(primaryKeyColumn.Table.TableName, primaryKeyColumn.Table.TableNamePrefix, defaultTableNamePrefix),
                                    MAX_CONSTRAINT_NAME_CHARS, shortenNamesByRemovingVowelsFirst, fixBreakBug, null));
     }
 }
Пример #2
0
        public void AddColumn(Column column)
        {
            string tableName = string.IsNullOrEmpty(column.Table.TableAliasName) ?
                               column.Table.TableName : column.Table.TableAliasName;

            if (tableName != m_TableName)
            {
                throw new ArgumentException(string.Format("The input column does not belong to this table: \"{0}\" vs. \"{1}\"",
                                                          tableName, m_TableName));
            }
            if (ContainsColumn(column.ColumnName))
            {
                throw new ArgumentException(string.Format("This table already contains a column with the same name: \"{0}\"",
                                                          column.ColumnName));
            }
            m_Columns.Add(column);
            PrimaryKeyColumn primaryKeyColumn = column as PrimaryKeyColumn;

            if (primaryKeyColumn != null)
            {
                m_PrimaryKeyColumns.Add(primaryKeyColumn);
            }
        }