Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CascadeCommit()

void System.Data.ForeignKeyConstraint.CascadeCommit ( DataRow row)
inlinepackage

Definition at line 278 of file ForeignKeyConstraint.cs.

279 {
280 if (row.RowState == DataRowState.Detached || _acceptRejectRule != AcceptRejectRule.Cascade)
281 {
282 return;
283 }
284 Index sortIndex = _childKey.GetSortIndex((row.RowState == DataRowState.Deleted) ? DataViewRowState.Deleted : DataViewRowState.CurrentRows);
285 object[] keyValues = row.GetKeyValues(_parentKey, (row.RowState == DataRowState.Deleted) ? DataRowVersion.Original : DataRowVersion.Default);
286 if (IsKeyNull(keyValues))
287 {
288 return;
289 }
290 Range range = sortIndex.FindRecords(keyValues);
291 if (range.IsNull)
292 {
293 return;
294 }
295 DataRow[] rows = sortIndex.GetRows(range);
296 DataRow[] array = rows;
297 foreach (DataRow dataRow in array)
298 {
299 if (DataRowState.Detached != dataRow.RowState && !dataRow._inCascade)
300 {
301 dataRow.AcceptChanges();
302 }
303 }
304 }
Index GetSortIndex()
Definition DataKey.cs:184

References System.Data.ForeignKeyConstraint._acceptRejectRule, System.Data.ForeignKeyConstraint._childKey, System.Data.DataRow._inCascade, System.Data.ForeignKeyConstraint._parentKey, System.Data.DataRow.AcceptChanges(), System.array, System.Data.Index.FindRecords(), System.Data.DataRow.GetKeyValues(), System.Data.Index.GetRows(), System.Data.DataKey.GetSortIndex(), System.Data.ForeignKeyConstraint.IsKeyNull(), System.Data.Range.IsNull, and System.Data.DataRow.RowState.

Referenced by System.Data.ForeignKeyConstraint.CheckCascade().