internal void CascadeRollback(DataRow row)
{
Index childIndex = _childKey.GetSortIndex(row.RowState == DataRowState.Deleted ? DataViewRowState.OriginalRows : DataViewRowState.CurrentRows);
object[] key = row.GetKeyValues(_parentKey, row.RowState == DataRowState.Modified ? DataRowVersion.Current : DataRowVersion.Default);
if (IsKeyNull(key))
{
return;
}
Range range = childIndex.FindRecords(key);
if (_acceptRejectRule == AcceptRejectRule.Cascade)
{
if (!range.IsNull)
{
DataRow[] rows = childIndex.GetRows(range);
for (int j = 0; j < rows.Length; j++)
{
if (rows[j]._inCascade)
continue;
rows[j].RejectChanges();
}
}
}
else
{
// AcceptRejectRule.None
if (row.RowState != DataRowState.Deleted && row.Table.DataSet.EnforceConstraints)
{
if (!range.IsNull)
{
if (range.Count == 1 && childIndex.GetRow(range.Min) == row)
return;
if (row.HasKeyChanged(_parentKey))
{// if key is not changed, this will not cause child to be stranded
throw ExceptionBuilder.FailedCascadeUpdate(ConstraintName);
}
}
}
}
}