Exemple #1
0
 public static void CopyAllForeignKeyConstraintsForPrimaryKeyColumns(
     EdmModel database,
     EntityType fromTable,
     EntityType toTable)
 {
     foreach (EdmProperty keyProperty in fromTable.KeyProperties)
     {
         ((IEnumerable <ForeignKeyBuilder>)ForeignKeyPrimitiveOperations.FindAllForeignKeyConstraintsForColumn(fromTable, toTable, keyProperty).ToArray <ForeignKeyBuilder>()).Each <ForeignKeyBuilder>((Action <ForeignKeyBuilder>)(fk =>
         {
             if (fk.GetIsTypeConstraint())
             {
                 return;
             }
             ForeignKeyPrimitiveOperations.CopyForeignKeyConstraint(database, toTable, fk, (Func <EdmProperty, EdmProperty>)null);
         }));
     }
 }
Exemple #2
0
 public static void CopyAllForeignKeyConstraintsForColumn(
     EdmModel database,
     EntityType fromTable,
     EntityType toTable,
     EdmProperty column,
     EdmProperty movedColumn)
 {
     ((IEnumerable <ForeignKeyBuilder>)ForeignKeyPrimitiveOperations.FindAllForeignKeyConstraintsForColumn(fromTable, toTable, column).ToArray <ForeignKeyBuilder>()).Each <ForeignKeyBuilder>((Action <ForeignKeyBuilder>)(fk => ForeignKeyPrimitiveOperations.CopyForeignKeyConstraint(database, toTable, fk, (Func <EdmProperty, EdmProperty>)(c =>
     {
         if (c != column)
         {
             return(c);
         }
         return(movedColumn);
     }))));
 }