System.Data.ForeignKeyConstraint.CascadeCommit C# (CSharp) Method

CascadeCommit() private method

private CascadeCommit ( DataRow row ) : void
row DataRow
return void
        internal void CascadeCommit(DataRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                return;
            }

            if (_acceptRejectRule == AcceptRejectRule.Cascade)
            {
                Index childIndex = _childKey.GetSortIndex(row.RowState == DataRowState.Deleted ? DataViewRowState.Deleted : DataViewRowState.CurrentRows);
                object[] key = row.GetKeyValues(_parentKey, row.RowState == DataRowState.Deleted ? DataRowVersion.Original : DataRowVersion.Default);
                if (IsKeyNull(key))
                {
                    return;
                }

                Range range = childIndex.FindRecords(key);
                if (!range.IsNull)
                {
                    // Self-referencing table has suspendIndexEvents, in the multi-table scenario the child table hasn't
                    // this allows the self-ref table to maintain the index while in the child-table doesn't
                    DataRow[] rows = childIndex.GetRows(range);
                    foreach (DataRow childRow in rows)
                    {
                        if (DataRowState.Detached != childRow.RowState)
                        {
                            if (childRow._inCascade)
                                continue;
                            childRow.AcceptChanges();
                        }
                    }
                }
            }
        }