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

◆ SetNewRecordWorker()

void System.Data.DataTable.SetNewRecordWorker ( DataRow row,
int proposedRecord,
DataRowAction action,
bool isInMerge,
bool suppressEnsurePropertyChanged,
int position,
bool fireEvent,
out Exception deferredException )
inlineprivateinherited

Definition at line 3811 of file DataTable.cs.

3812 {
3813 deferredException = null;
3814 if (row._tempRecord != proposedRecord)
3815 {
3816 if (!_inDataLoad)
3817 {
3818 row.CheckInTable();
3820 }
3821 if (proposedRecord == row._newRecord)
3822 {
3823 if (isInMerge)
3824 {
3825 RaiseRowChanged(null, row, action);
3826 }
3827 return;
3828 }
3830 }
3831 DataRowChangeEventArgs args = null;
3832 try
3833 {
3836 }
3837 catch
3838 {
3839 row._tempRecord = -1;
3840 throw;
3841 }
3842 finally
3843 {
3844 row._action = DataRowAction.Nothing;
3845 }
3846 row._tempRecord = -1;
3847 int record = row._newRecord;
3848 int num = ((proposedRecord != -1) ? proposedRecord : ((row.RowState != DataRowState.Unchanged) ? row._oldRecord : (-1)));
3849 if (action == DataRowAction.Add)
3850 {
3851 if (position == -1)
3852 {
3853 Rows.ArrayAdd(row);
3854 }
3855 else
3856 {
3857 Rows.ArrayInsert(row, position);
3858 }
3859 }
3860 List<DataRow> list = null;
3861 if ((action == DataRowAction.Delete || action == DataRowAction.Change) && _dependentColumns != null && _dependentColumns.Count > 0)
3862 {
3863 list = new List<DataRow>();
3864 for (int i = 0; i < ParentRelations.Count; i++)
3865 {
3866 DataRelation dataRelation = ParentRelations[i];
3867 if (dataRelation.ChildTable == row.Table)
3868 {
3869 list.InsertRange(list.Count, row.GetParentRows(dataRelation));
3870 }
3871 }
3872 for (int j = 0; j < ChildRelations.Count; j++)
3873 {
3874 DataRelation dataRelation2 = ChildRelations[j];
3875 if (dataRelation2.ParentTable == row.Table)
3876 {
3877 list.InsertRange(list.Count, row.GetChildRows(dataRelation2));
3878 }
3879 }
3880 }
3881 if (!suppressEnsurePropertyChanged && !row.HasPropertyChanged && row._newRecord != proposedRecord && -1 != proposedRecord && -1 != row._newRecord)
3882 {
3883 row.LastChangedColumn = null;
3884 row.LastChangedColumn = null;
3885 }
3886 if (LiveIndexes.Count != 0)
3887 {
3888 if (-1 == record && -1 != proposedRecord && -1 != row._oldRecord && proposedRecord != row._oldRecord)
3889 {
3890 record = row._oldRecord;
3891 }
3892 DataViewRowState recordState = row.GetRecordState(record);
3893 DataViewRowState recordState2 = row.GetRecordState(num);
3895 if (proposedRecord != -1)
3896 {
3898 }
3899 DataViewRowState recordState3 = row.GetRecordState(record);
3900 DataViewRowState recordState4 = row.GetRecordState(num);
3902 }
3903 else
3904 {
3906 if (proposedRecord != -1)
3907 {
3909 }
3910 }
3911 row.ResetLastChangedColumn();
3912 if (-1 != record && record != row._oldRecord && record != row._tempRecord && record != row._newRecord && row == _recordManager[record])
3913 {
3915 }
3916 if (row.RowState == DataRowState.Detached && row.rowID != -1)
3917 {
3918 RemoveRow(row, check: false);
3919 }
3920 if (_dependentColumns != null && _dependentColumns.Count > 0)
3921 {
3922 try
3923 {
3925 }
3926 catch (Exception ex)
3927 {
3928 if (action != DataRowAction.Add)
3929 {
3930 throw;
3931 }
3933 }
3934 }
3935 try
3936 {
3937 if (fireEvent)
3938 {
3940 }
3941 }
3942 catch (Exception e) when (ADP.IsCatchableExceptionType(e))
3943 {
3944 ExceptionBuilder.TraceExceptionWithoutRethrow(e);
3945 }
3946 }
static bool IsCatchableExceptionType(Exception e)
Definition ADP.cs:790
void ArrayInsert(DataRow row, int pos)
void CheckNotModifying(DataRow row)
DataRowCollection Rows
Definition DataTable.cs:701
void FreeRecord(ref int record)
DataRelationCollection ParentRelations
Definition DataTable.cs:572
DataRowChangeEventArgs RaiseRowChanging(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction)
List< DataColumn > _dependentColumns
Definition DataTable.cs:160
void RecordStateChanged(int record, DataViewRowState oldState, DataViewRowState newState)
readonly RecordManager _recordManager
Definition DataTable.cs:74
DataRowChangeEventArgs RaiseRowChanged(DataRowChangeEventArgs args, DataRow eRow, DataRowAction eAction)
void RemoveRow(DataRow row, bool check)
DataRelationCollection ChildRelations
Definition DataTable.cs:324
List< Index > LiveIndexes
Definition DataTable.cs:269

References System.Data.DataTable._dependentColumns, System.Data.DataTable._inDataLoad, System.Data.DataTable._recordManager, System.action, System.Data.DataRowCollection.ArrayAdd(), System.Data.DataRowCollection.ArrayInsert(), System.Data.DataTable.CheckNotModifying(), System.Data.DataTable.ChildRelations, System.Data.InternalDataCollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Runtime.Serialization.Dictionary, System.Data.DataTable.EvaluateExpressions(), System.Data.DataTable.FreeRecord(), System.Data.Common.ADP.IsCatchableExceptionType(), System.list, System.Data.DataTable.LiveIndexes, System.Data.DataTable.ParentRelations, System.Data.DataTable.RaiseRowChanged(), System.Data.DataTable.RaiseRowChanging(), System.Data.DataTable.RecordStateChanged(), System.Data.DataTable.RemoveRow(), System.Data.DataTable.Rows, and System.Data.ExceptionBuilder.TraceExceptionWithoutRethrow().

Referenced by System.Data.DataTable.InsertRow(), and System.Data.DataTable.SetNewRecord().