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

◆ Clear()

void System.Data.ConstraintCollection.Clear ( )
inline

Definition at line 348 of file ConstraintCollection.cs.

349 {
350 _table.PrimaryKey = null;
351 for (int i = 0; i < _table.ParentRelations.Count; i++)
352 {
353 _table.ParentRelations[i].SetChildKeyConstraint(null);
354 }
355 for (int j = 0; j < _table.ChildRelations.Count; j++)
356 {
357 _table.ChildRelations[j].SetParentKeyConstraint(null);
358 }
360 {
363 }
364 int count = List.Count;
365 Constraint[] array = new Constraint[List.Count];
366 List.CopyTo(array, 0);
367 try
368 {
369 BaseGroupSwitch(array, count, Array.Empty<Constraint>(), 0);
370 }
371 catch (Exception e) when (ADP.IsCatchableOrSecurityExceptionType(e))
372 {
373 BaseGroupSwitch(Array.Empty<Constraint>(), 0, array, count);
374 List.Clear();
375 for (int k = 0; k < count; k++)
376 {
377 List.Add(array[k]);
378 }
379 throw;
380 }
381 List.Clear();
382 OnCollectionChanged(InternalDataCollectionBase.s_refreshEventArgs);
383 }
virtual int Add(object? value)
virtual void CopyTo(Array array)
static bool IsCatchableOrSecurityExceptionType(Exception e)
Definition ADP.cs:800
void OnCollectionChanged(CollectionChangeEventArgs ccevent)
void BaseGroupSwitch(Constraint[] oldArray, int oldLength, Constraint[] newArray, int newLength)
DataRelationCollection ParentRelations
Definition DataTable.cs:572
DataRelationCollection ChildRelations
Definition DataTable.cs:324

References System.Data.ConstraintCollection._delayLoadingConstraints, System.Data.ConstraintCollection._fLoadForeignKeyConstraintsOnly, System.Data.ConstraintCollection._table, System.Collections.ArrayList.Add(), System.array, System.Data.ConstraintCollection.BaseGroupSwitch(), System.Data.DataTable.ChildRelations, System.Collections.ArrayList.Clear(), System.Collections.ArrayList.CopyTo(), System.Data.InternalDataCollectionBase.Count, System.count, System.Collections.ArrayList.Count, System.Data.DataTable.fInitInProgress, System.Data.Common.ADP.IsCatchableOrSecurityExceptionType(), System.Data.ConstraintCollection.List, System.Data.ConstraintCollection.OnCollectionChanged(), System.Data.DataTable.ParentRelations, and System.Data.InternalDataCollectionBase.s_refreshEventArgs.

Referenced by System.Data.DataTable.ResetConstraints().