Esempio n. 1
0
 public ForeignKey(SqlTable table, SqlTable referredTable, string name)
     : base(table)
 {
     Name          = name;
     ReferredTable = referredTable;
 }
Esempio n. 2
0
 public ForeignKeyRegistrationToReferredTable(SqlTable table, SchemaAndTableName referredTableName, bool isNullable, string fkName, List <ColumnReference> map)
     : base(table, referredTableName, isNullable, fkName)
 {
     Map = map;
 }
Esempio n. 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);
        }
Esempio n. 6
0
 public CircularFK(SqlTable sqlTable)
     : base(sqlTable)
 {
 }
Esempio n. 7
0
 private static IEnumerable <T> GetProperties <T>(SqlTable sqlTable)
 {
     return(sqlTable.Properties.OfType <T>().ToList());
 }
Esempio n. 8
0
 protected IndexBase(SqlTable sqlTable, string name, bool unique = false)
     : base(sqlTable)
 {
     Name   = name;
     Unique = unique;
 }
Esempio n. 9
0
 public static SqlTable SetForeignKeyTo(this SqlTable table, string referredTableName, IEnumerable <SqlEngineVersionSpecificProperty> properties, ColumnReference[] columnReferences)
 {
     return(SetForeignKeyTo(table, referredTableName, null, properties, columnReferences));
 }
Esempio n. 10
0
 public static SqlTable SetForeignKeyTo(this SqlTable table, string referredTableName, string fkName, ColumnReference[] columnReferences)
 {
     return(SetForeignKeyTo(table, referredTableName, fkName, null, columnReferences));
 }