Beispiel #1
0
 public ForeignKey(SqlTable table, SqlTable referredTable, string name)
     : base(table)
 {
     Name          = name;
     ReferredTable = referredTable;
 }
Beispiel #2
0
 public ForeignKeyRegistrationToReferredTable(SqlTable table, SchemaAndTableName referredTableName, bool isNullable, string fkName, List <ColumnReference> map)
     : base(table, referredTableName, isNullable, fkName)
 {
     Map = map;
 }
Beispiel #3
0
 public Index(SqlTable sqlTable, string name, bool unique = false)
     : base(sqlTable, name, unique)
 {
 }
        public static void ReferredTableExistingColumns(DatabaseDefinition definition, SqlTable sqlTable, ForeignKeyRegistrationToReferredTableExistingColumns fkRegistration)
        {
            var referredTable = definition.GetTable(fkRegistration.ReferredTableName);

            var fk = ReplaceFKRegistrationWithNewFK(sqlTable, fkRegistration, referredTable);

            foreach (var fkGroup in fkRegistration.Map)
            {
                fk.ForeignKeyColumns.Add(new ForeignKeyColumnMap(sqlTable.Columns[fkGroup.ColumnName], referredTable[fkGroup.ReferredColumnName]));
            }
        }
        private static ForeignKey ReplaceFKRegistrationWithNewFK(SqlTable sqlTable, ForeignKeyRegistrationBase fkRegistration, SqlTable referredTable)
        {
            sqlTable.Properties.Remove(fkRegistration);
            var fk = new ForeignKey(sqlTable, referredTable, fkRegistration.Name);

            fk.SqlEngineVersionSpecificProperties.AddRange(fkRegistration.SqlEngineVersionSpecificProperties);
            sqlTable.Properties.Add(fk);
            return(fk);
        }
Beispiel #6
0
 public CircularFK(SqlTable sqlTable)
     : base(sqlTable)
 {
 }
Beispiel #7
0
 private static IEnumerable <T> GetProperties <T>(SqlTable sqlTable)
 {
     return(sqlTable.Properties.OfType <T>().ToList());
 }
Beispiel #8
0
 protected IndexBase(SqlTable sqlTable, string name, bool unique = false)
     : base(sqlTable)
 {
     Name   = name;
     Unique = unique;
 }
Beispiel #9
0
 public static SqlTable SetForeignKeyTo(this SqlTable table, string referredTableName, IEnumerable <SqlEngineVersionSpecificProperty> properties, ColumnReference[] columnReferences)
 {
     return(SetForeignKeyTo(table, referredTableName, null, properties, columnReferences));
 }
Beispiel #10
0
 public static SqlTable SetForeignKeyTo(this SqlTable table, string referredTableName, string fkName, ColumnReference[] columnReferences)
 {
     return(SetForeignKeyTo(table, referredTableName, fkName, null, columnReferences));
 }