private static List <DroppedDependencyDbo> ModifyColumn(ProcessColumnDelegate processor, Table aTable, DataColumnDbo column, bool disableDependencies, Database db) { var rzlt = new List <DroppedDependencyDbo>(); IndexKeyType oldIndexKeyType; bool oldIsClustered; string oldIndexName; for (int i = aTable.Indexes.Count - 1; i >= 0; i--) { Index currentInd = aTable.Indexes[i]; string[] indexColumns = GetIndexColumns(currentInd); if (indexColumns.Contains(column.Name)) { if (disableDependencies) { DropDependentForeignKeys(currentInd.Name, db, rzlt); } oldIndexName = currentInd.Name; oldIndexKeyType = currentInd.IndexKeyType; oldIsClustered = currentInd.IsClustered; currentInd.Drop(); processor(aTable, column); CreateNewPrimaryKey(aTable, oldIndexName, oldIndexKeyType, indexColumns); return(rzlt); } } // No index contains column processor(aTable, column); return(rzlt); }
private static List<DroppedDependencyDbo> ModifyColumn(ProcessColumnDelegate processor, Table aTable, DataColumnDbo column, bool disableDependencies, Database db) { var rzlt = new List<DroppedDependencyDbo>(); IndexKeyType oldIndexKeyType; bool oldIsClustered; string oldIndexName; for (int i = aTable.Indexes.Count - 1; i >= 0; i--) { Index currentInd = aTable.Indexes[i]; string[] indexColumns = GetIndexColumns(currentInd); if (indexColumns.Contains(column.Name)) { if (disableDependencies) DropDependentForeignKeys(currentInd.Name, db, rzlt); oldIndexName = currentInd.Name; oldIndexKeyType = currentInd.IndexKeyType; oldIsClustered = currentInd.IsClustered; currentInd.Drop(); processor(aTable, column); CreateNewPrimaryKey(aTable, oldIndexName, oldIndexKeyType, indexColumns); return rzlt; } } // No index contains column processor(aTable, column); return rzlt; }