internal override bool CanBeRemovedFromCollection(ConstraintCollection constraints, bool fThrowException)
{
if (Equals(constraints.Table._primaryKey))
{
Debug.Assert(constraints.Table._primaryKey == this, "If the primary key and this are 'Equal', they should also be '=='");
if (!fThrowException)
return false;
else
throw ExceptionBuilder.RemovePrimaryKey(constraints.Table);
}
for (ParentForeignKeyConstraintEnumerator cs = new ParentForeignKeyConstraintEnumerator(Table.DataSet, Table); cs.GetNext();)
{
ForeignKeyConstraint constraint = cs.GetForeignKeyConstraint();
if (!_key.ColumnsEqual(constraint.ParentKey))
continue;
if (!fThrowException)
return false;
else
throw ExceptionBuilder.NeededForForeignKeyConstraint(this, constraint);
}
return true;
}