System\Data\Common\DBCommandBuilder.cs (13)
793private DbCommand BuildDeleteCommand(DataTableMapping? mappings, DataRow? dataRow)
813private DbCommand BuildInsertCommand(DataTableMapping? mappings, DataRow? dataRow)
904private DbCommand? BuildUpdateCommand(DataTableMapping? mappings, DataRow? dataRow)
993DataRow? dataRow,
1235private DataTableMapping? GetTableMapping(DataRow? dataRow)
1321internal DbCommand GetInsertCommand(DataRow? dataRow, bool useColumnsForParameterNames)
1338internal DbCommand GetUpdateCommand(DataRow? dataRow, bool useColumnsForParameterNames)
1355internal DbCommand GetDeleteCommand(DataRow? dataRow, bool useColumnsForParameterNames)
1362private object? GetColumnValue(DataRow row, string columnName, DataTableMapping mappings, DataRowVersion version)
1368private static object? GetColumnValue(DataRow row, DataColumn? column, DataRowVersion version)
1378private DataColumn? GetDataColumn(string columnName, DataTableMapping tablemapping, DataRow row)
1600DataRow datarow = rowUpdatingEvent.Row;
1636protected abstract void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause);
System\Data\Common\DbDataAdapter.cs (24)
27internal DataRow _row; // the row that the command is intended to update
257protected virtual RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand? command, StatementType statementType, DataTableMapping tableMapping)
262protected virtual RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand? command, StatementType statementType, DataTableMapping tableMapping)
749private void ParameterInput(IDataParameterCollection parameters, StatementType typeIndex, DataRow row, DataTableMapping mappings)
783private static void ParameterOutput(IDataParameter parameter, DataRow row, DataTableMapping mappings, MissingMappingAction missingMapping, MissingSchemaAction missingSchema)
819private void ParameterOutput(IDataParameterCollection parameters, DataRow row, DataTableMapping mappings)
848public int Update(DataRow[] dataRows)
961protected virtual int Update(DataRow[] dataRows, DataTableMapping tableMapping)
995DataRow[] rowBatch = new DataRow[maxBatchCommands];
1011foreach (DataRow dataRow in dataRows)
1300DataRow[] finalRowBatch = rowBatch;
1304finalRowBatch = new DataRow[commandCount];
1385List<DataRow>? rows = null;
1414rows = new List<DataRow>();
1416batchCommands[bc]._errors = ADP.UpdateConcurrencyViolation(batchCommands[bc]._statementType, 0, 1, new DataRow[] { rowUpdatedEvent.Rows[bc] });
1452DataRow[] rowsInError = (null != rows) ? rows.ToArray() : rowUpdatedEvent.Rows!;
1486DataRow[] dataRows = ADP.SelectAdapterRows(dataTable, false);
1586rowUpdatedEvent.Errors = ADP.UpdateConcurrencyViolation(cmdIndex, rowUpdatedEvent.RecordsAffected, 1, new DataRow[] { rowUpdatedEvent.Row });
1635DataRow row = batchCommand._row;
1669DataRow row = batchCommands[i]._row;
1687DataRow row = batchCommands[i]._row;
1712DataRow row = batchCommands[i]._row;
1722private void UpdatingRowStatusErrors(RowUpdatingEventArgs rowUpdatedEvent, DataRow dataRow)
System\Data\DataRelation.cs (10)
219internal static DataRow[] GetChildRows(DataKey parentKey, DataKey childKey, DataRow parentRow, DataRowVersion version)
234internal static DataRow[] GetParentRows(DataKey parentKey, DataKey childKey, DataRow childRow, DataRowVersion version)
246internal static DataRow? GetParentRow(DataKey parentKey, DataKey childKey, DataRow childRow, DataRowVersion version)
289internal void SetParentRowRecords(DataRow childRow, DataRow parentRow)
512foreach (DataRow row in ChildTable.Rows)
525foreach (DataRow row in ChildTable.Rows)
System\Data\DataRow.cs (30)
213DataRow? parent = GetParentRow(rel);
239DataRow? row = GetParentRow(rel);
536/// Commits all the changes made to this row since the last time <see cref='System.Data.DataRow.AcceptChanges'/> was called.
572/// Begins an edit operation on a <see cref='System.Data.DataRow'/>object.
769/// Clears the errors for the row, including the <see cref='System.Data.DataRow.RowError'/>
770/// and errors set with <see cref='System.Data.DataRow.SetColumnError(DataColumn, string)'/>
801public DataRow[] GetChildRows(string? relationName) =>
804public DataRow[] GetChildRows(string? relationName, DataRowVersion version) =>
808/// Gets the child rows of this <see cref='System.Data.DataRow'/> using the
811public DataRow[] GetChildRows(DataRelation? relation) =>
815/// Gets the child rows of this <see cref='System.Data.DataRow'/> using the specified <see cref='System.Data.DataRelation'/> and the specified <see cref='System.Data.DataRowVersion'/>
817public DataRow[] GetChildRows(DataRelation? relation, DataRowVersion version)
845public DataRow? GetParentRow(string? relationName) =>
848public DataRow? GetParentRow(string? relationName, DataRowVersion version) =>
852/// Gets the parent row of this <see cref='System.Data.DataRow'/> using the specified <see cref='System.Data.DataRelation'/> .
854public DataRow? GetParentRow(DataRelation? relation) =>
858/// Gets the parent row of this <see cref='System.Data.DataRow'/>
861public DataRow? GetParentRow(DataRelation? relation, DataRowVersion version)
883internal DataRow? GetNestedParentRow(DataRowVersion version)
898DataRow? row = GetParentRow(rel, version);
908public DataRow[] GetParentRows(string? relationName) =>
911public DataRow[] GetParentRows(string? relationName, DataRowVersion version) =>
915/// Gets the parent rows of this <see cref='System.Data.DataRow'/> using the specified <see cref='System.Data.DataRelation'/> .
917public DataRow[] GetParentRows(DataRelation? relation) =>
921/// Gets the parent rows of this <see cref='System.Data.DataRow'/> using the specified <see cref='System.Data.DataRelation'/> .
923public DataRow[] GetParentRows(DataRelation? relation, DataRowVersion version)
1174/// Rejects all changes made to the row since <see cref='System.Data.DataRow.AcceptChanges'/>
1268internal void SetNestedParentRow(DataRow? parentRow, bool setNonNested)
1301public void SetParentRow(DataRow? parentRow)
1309public void SetParentRow(DataRow? parentRow, DataRelation? relation)
System\Data\DataRowExtensions.cs (9)
23public static T? Field<T>(this DataRow row, string columnName)
38public static T? Field<T>(this DataRow row, DataColumn column)
53public static T? Field<T>(this DataRow row, int columnIndex)
69public static T? Field<T>(this DataRow row, int columnIndex, DataRowVersion version)
85public static T? Field<T>(this DataRow row, string columnName, DataRowVersion version)
101public static T? Field<T>(this DataRow row, DataColumn column, DataRowVersion version)
113public static void SetField<T>(this DataRow row, int columnIndex, T? value)
125public static void SetField<T>(this DataRow row, string columnName, T? value)
137public static void SetField<T>(this DataRow row, DataColumn column, T? value)
System\Data\DataTable.cs (119)
41/// Monotonically increasing number representing the order <see cref="DataRow"/> have been added to <see cref="DataRowCollection"/>.
43/// <remarks>This limits <see cref="DataRowCollection.Add(DataRow)"/> to <see cref="int.MaxValue"/> operations.</remarks>
117private DataRow[]? _emptyDataRowArray;
702DataRow row = Rows[i];
809DataRow[] rowArr = new DataRow[recordCount];
813DataRow row = NewEmptyRow();
903DataRow row = Rows[rowIndex];
934DataRow row = Rows[rowIndex];
2130internal DataRow? FindByIndex(Index ndx, object[] key)
2136internal DataRow? FindMergeTarget(DataRow row, DataKey key, Index ndx)
2138DataRow? targetRow = null;
2151private void SetMergeRecords(DataRow row, int newRecord, int oldRecord, DataRowAction action)
2169internal DataRow MergeRow(DataRow row, DataRow? targetRow, bool preserveChanges, Index? idxSearch)
2296DataRow[] oldRows = new DataRow[Rows.Count];
2526foreach (DataRow row in Rows)
2608/// Occurs when the <see cref='System.Data.DataRow'/> is changing.
2724internal DataRow AddRecords(int oldRecord, int newRecord)
2726DataRow row;
2742internal void AddRow(DataRow row) => AddRow(row, -1);
2744internal void AddRow(DataRow row, int proposedID) => InsertRow(row, proposedID, -1);
2746internal void InsertRow(DataRow row, int proposedID, int pos) => InsertRow(row, proposedID, pos, fireEvent: true);
2748internal void InsertRow(DataRow row, long proposedID, int pos, bool fireEvent)
2824internal static void CheckNotModifying(DataRow row)
2867foreach (DataRow row in Rows)
2895internal void CascadeAll(DataRow row, DataRowAction action)
2906internal void CommitRow(DataRow row)
2971DataRow[] rows = Select(filter, "", DataViewRowState.CurrentRows);
2978internal static void CopyRow(DataTable table, DataRow row)
3003DataRow targetRow = table.AddRecords(oldRecord, newRecord);
3019internal void DeleteRow(DataRow row)
3035internal DataRow? FindByPrimaryKey(object?[] values)
3041internal DataRow? FindByPrimaryKey(object? value)
3047private DataRow? FindRow(DataKey key, object?[] values)
3058private DataRow? FindRow(DataKey key, object? value)
3098DataRow? row = null;
3128DataRow? row = null;
3156/// Returns an array of <see cref='System.Data.DataRow'/> objects that contain errors.
3158public DataRow[] GetErrors()
3160List<DataRow> errorList = new List<DataRow>();
3164DataRow row = Rows[i];
3171DataRow[] temp = NewRowArray(errorList.Count);
3233public void ImportRow(DataRow? row)
3263DataRow targetRow = AddRecords(oldRecord, newRecord);
3285internal void InsertRow(DataRow row, long proposedID)
3443internal DataRow NewEmptyRow()
3446DataRow dr = NewRowFromBuilder(_rowBuilder);
3451private DataRow NewUninitializedRow() => NewRow(NewUninitializedRecord());
3454/// Creates a new <see cref='System.Data.DataRow'/>
3457public DataRow NewRow()
3459DataRow dr = NewRow(-1);
3465internal DataRow CreateEmptyRow()
3467DataRow row = NewUninitializedRow();
3493private void NewRowCreated(DataRow row)
3502internal DataRow NewRow(int record)
3510DataRow row = NewRowFromBuilder(_rowBuilder);
3519protected virtual DataRow NewRowFromBuilder(DataRowBuilder builder) => new DataRow(builder);
3524protected virtual Type GetRowType() => typeof(DataRow);
3530protected internal DataRow[] NewRowArray(int size)
3538_emptyDataRowArray = (DataRow[])Array.CreateInstance(GetRowType(), 0);
3542return (DataRow[])Array.CreateInstance(GetRowType(), size);
3546return ((0 == size) ? Array.Empty<DataRow>() : new DataRow[size]);
3591private DataRowChangeEventArgs? OnRowChanged(DataRowChangeEventArgs? args, DataRow eRow, DataRowAction eAction)
3604private DataRowChangeEventArgs? OnRowChanging(DataRowChangeEventArgs? args, DataRow eRow, DataRowAction eAction)
3870internal int[] RemoveRecordFromIndexes(DataRow row, DataRowVersion version)
3904internal int[] InsertRecordToIndexes(DataRow row, DataRowVersion version)
3929internal static void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue)
3975DataRow[] oldRows = new DataRow[Rows.Count];
3989internal void RemoveRow(DataRow row, bool check)
4107internal void RollbackRow(DataRow row)
4113private DataRowChangeEventArgs? RaiseRowChanged(DataRowChangeEventArgs? args, DataRow eRow, DataRowAction eAction)
4138private DataRowChangeEventArgs? RaiseRowChanging(DataRowChangeEventArgs? args, DataRow eRow, DataRowAction eAction)
4175private DataRowChangeEventArgs? RaiseRowChanging(DataRowChangeEventArgs? args, DataRow eRow, DataRowAction eAction, bool fireEvent)
4214/// Returns an array of all <see cref='System.Data.DataRow'/> objects.
4218public DataRow[] Select()
4225/// Returns an array of all <see cref='System.Data.DataRow'/> objects that match the filter criteria in order of
4229public DataRow[] Select(string? filterExpression)
4236/// Returns an array of all <see cref='System.Data.DataRow'/> objects that match the filter criteria, in the
4240public DataRow[] Select(string? filterExpression, string? sort)
4247/// Returns an array of all <see cref='System.Data.DataRow'/> objects that match the filter in the order of the
4251public DataRow[] Select(string? filterExpression, string? sort, DataViewRowState recordStates)
4257internal void SetNewRecord(DataRow row, int proposedRecord, DataRowAction action = DataRowAction.Change, bool isInMerge = false, bool fireEvent = true, bool suppressEnsurePropertyChanged = false)
4267private void SetNewRecordWorker(DataRow row, int proposedRecord, DataRowAction action, bool isInMerge, bool suppressEnsurePropertyChanged,
4350List<DataRow>? cachedRows = null;
4356cachedRows = new List<DataRow>();
4486internal void SetOldRecord(DataRow row, int proposedRecord)
4683public DataRow LoadDataRow(object?[] values, bool fAcceptChanges)
4688DataRow row;
4744public DataRow LoadDataRow(object?[] values, LoadOption loadOption)
4783DataRow dataRow = LoadRow(values, loadOption, indextoUse); // if indextoUse == null, it means we dont have PK,
4794internal DataRow UpdatingAdd(object?[] values)
4809DataRow row = _recordManager[resultRecord]!;
4815DataRow row2 = NewRow(record);
5007private DataRow LoadRow(object?[] values, LoadOption loadOption, Index? searchIndex)
5010DataRow? dataRow = null;
5111private void SetDataRowWithLoadOption(DataRow dataRow, int recordNo, LoadOption loadOption, bool checkReadOnly)
6394foreach (DataRow r in tableList[i].Rows)
6969foreach (DataRow row in Rows)
6988internal void EvaluateExpressions(DataRow row, DataRowAction action, List<DataRow>? cachedRows)
7018DataRow tableRow = Rows[j];
7027DataRow tableRow = Rows[j];
7040DataRow tableRow = Rows[j];
7053foreach (DataRow relatedRow in cachedRows)
7085DataRow row = column._table.Rows[j];
7105DataRow row = column._table.Rows[j];
7141internal void EvaluateDependentExpressions(List<DataColumn>? columns, DataRow row, DataRowVersion version, List<DataRow>? cachedRows)
7170DataRow dr = Rows[j];
7214foreach (DataRow cachedRow in cachedRows)
7246foreach (DataRow parentRow in row.GetParentRows(relation, version))
7278foreach (DataRow childRow in row.GetChildRows(relation, version))
System\Data\DataView.cs (27)
36private System.Comparison<DataRow>? _comparison;
52internal DataRow? _addNewRow;
74private Dictionary<DataRow, DataRowView> _rowViewCache = new Dictionary<DataRow, DataRowView>(DataRowReferenceComparer.s_default);
79private readonly Dictionary<DataRow, DataRowView> _rowViewBuffer = new Dictionary<DataRow, DataRowView>(DataRowReferenceComparer.s_default);
81private sealed class DataRowReferenceComparer : IEqualityComparer<DataRow>
87public bool Equals(DataRow? x, DataRow? y) => x == (object?)y;
89public int GetHashCode(DataRow obj) => obj._objectID;
163internal DataView(DataTable table, System.Predicate<DataRow>? predicate, System.Comparison<DataRow>? comparison, DataViewRowState RowState)
337internal Predicate<DataRow>? RowPredicate
355internal readonly Predicate<DataRow> _predicateFilter;
358internal RowPredicateFilter(Predicate<DataRow> predicate)
365bool IFilter.Invoke(DataRow row, DataRowVersion version)
448internal System.Comparison<DataRow>? SortComparison
680internal void Delete(DataRow row)
760internal Range FindRecords<TKey, TRow>(Index.ComparisonBySelector<TKey, TRow> comparison, TKey key) where TRow : DataRow
787DataRow newRow = _addNewRow;
1224internal DataRow GetRow(int index)
1242private DataRowView GetRowView(DataRow dr) => _rowViewCache[dr];
1285internal void MaintainDataView(ListChangedType changedType, DataRow? row, bool trackAddRemove)
1383DataRow dr = GetRow(e.NewIndex);
1451Dictionary<DataRow, DataRowView> rvc = new Dictionary<DataRow, DataRowView>(CountFromIndex, DataRowReferenceComparer.s_default);
1460DataRow row = _table!._recordManager[iterator.Current]!;
System\Data\Filter\BinaryNode.cs (4)
41internal override object Eval(DataRow? row, DataRowVersion version)
149private static object Eval(ExpressionNode expr, DataRow? row, DataRowVersion version, int[]? recordNos)
283private object EvalBinaryOp(int op, ExpressionNode left, ExpressionNode right, DataRow? row, DataRowVersion version, int[]? recordNos)
1531internal override object Eval(DataRow? row, DataRowVersion version)
System\Data\LinqDataView.cs (16)
23internal Func<object, DataRow, int>? comparerKeyRow; // comparer for DataView.Find(..
28internal readonly SortExpressionBuilder<DataRow>? sortExpressionBuilder;
36internal LinqDataView(DataTable table, SortExpressionBuilder<DataRow>? sortExpressionBuilder)
40this.sortExpressionBuilder = sortExpressionBuilder ?? new SortExpressionBuilder<DataRow>();
57Predicate<DataRow>? predicate_system,
58Comparison<DataRow>? comparison,
59Func<object, DataRow, int>? comparerKeyRow,
60SortExpressionBuilder<DataRow>? sortExpressionBuilder)
129Index.ComparisonBySelector<object, DataRow> compareDelg =
130new Index.ComparisonBySelector<object, DataRow>(comparerKeyRow!);
134Range range = FindRecords<object, DataRow>(compareDelg, keyList);
165Index.ComparisonBySelector<object, DataRow> compareDelg =
166new Index.ComparisonBySelector<object, DataRow>(comparerKeyRow!);
174Range range = FindRecords<object, DataRow>(compareDelg, keyList);
204Range range = FindRecords<object, DataRow>(
205new Index.ComparisonBySelector<object, DataRow>(comparerKeyRow!),
System\Data\Selection.cs (14)
68private readonly System.Comparison<DataRow>? _comparison;
93public Index(DataTable table, System.Comparison<DataRow> comparison, DataViewRowState recordStates, IFilter? rowFilter) :
109private Index(DataTable table, IndexField[] indexFields, System.Comparison<DataRow>? comparison, DataViewRowState recordStates, IFilter? rowFilter)
195DataRow? row = _table._recordManager[record];
451DataRow row = _table._recordManager[record]!;
627internal delegate int ComparisonBySelector<TKey, TRow>(TKey key, TRow row) where TRow : DataRow;
630internal Range FindRecords<TKey, TRow>(ComparisonBySelector<TKey, TRow> comparison, TKey key) where TRow : DataRow
697public DataRow GetRow(int i) => _table._recordManager[GetRecord(i)];
699public DataRow[] GetRows(object[] values) => GetRows(FindRecords(values));
701public DataRow[] GetRows(Range range)
703DataRow[] newRows = _table.NewRowArray(range.Count);
728foreach (DataRow b in _table.Rows)
795DataRow row = _table._recordManager[record];
873delegate (DataViewListener listener, ListChangedType type, DataRow? row, bool track)
System\Data\TypedTableBaseExtensions.cs (8)
18public static EnumerableRowCollection<TRow> Where<TRow>(this TypedTableBase<TRow> source, Func<TRow, bool> predicate) where TRow : DataRow
28public static OrderedEnumerableRowCollection<TRow> OrderBy<TRow, TKey>(this TypedTableBase<TRow> source, Func<TRow, TKey> keySelector) where TRow : DataRow
41IComparer<TKey> comparer) where TRow : DataRow
51public static OrderedEnumerableRowCollection<TRow> OrderByDescending<TRow, TKey>(this TypedTableBase<TRow> source, Func<TRow, TKey> keySelector) where TRow : DataRow
64IComparer<TKey> comparer) where TRow : DataRow
77public static EnumerableRowCollection<S> Select<TRow, S>(this TypedTableBase<TRow> source, Func<TRow, S> selector) where TRow : DataRow
89public static EnumerableRowCollection<TRow> AsEnumerable<TRow>(this TypedTableBase<TRow> source) where TRow : DataRow
95public static TRow? ElementAtOrDefault<TRow>(this TypedTableBase<TRow> source, int index) where TRow : DataRow
System\Xml\XmlDataDocument.cs (55)
114internal void SyncRows(DataRow? parentRow, XmlNode node, bool fAddRowsToTable)
119DataRow? r = be.Row;
151DataRow? parentRow = null;
156DataRow? r = be.Row;
232internal void Bind(DataRow r, XmlBoundElement e)
366DataRow row = dt.CreateEmptyRow();
480DataRow? rowDocElem = GetRowFromElement(docElem);
543private void FixNestedChildren(DataRow row, XmlElement rowElement)
547foreach (DataRow r in row.GetChildRows(dr))
665DataRow row = node.Row;
784private ArrayList GetNestedChildRelations(DataRow row)
797private DataRow? GetNestedParent(DataRow row)
805private static DataRelation? GetNestedParentRelation(DataRow row)
813private DataColumn? GetTextOnlyColumn(DataRow row)
841public DataRow? GetRowFromElement(XmlElement? e)
846private XmlElement? GetRowInsertBeforeLocation(DataRow row, XmlNode parentElement)
848DataRow refRow = row;
859DataRow? parentRow = GetNestedParent(row);
877public XmlElement GetElementFromRow(DataRow r)
1252foreach (DataRow r in t.Rows)
1298DataRow? r = GetRowFromElement(be);
1324internal void OnDataRowCreated(object oDataSet, DataRow row)
1335internal void OnDataRowCreatedSpecial(object oDataSet, DataRow row)
1346internal void OnNewRow(DataRow row)
1355private XmlBoundElement AttachBoundElementToDataRow(DataRow row)
1367private bool NeedXSI_NilAttr(DataRow row)
1377private void OnAddRow(DataRow row)
1390DataRow? rowDocElem = GetRowFromElement(DocumentElement);
1393DataRow? parentRow = GetNestedParent(row);
1404private void OnColumnValueChanged(DataRow row, DataColumn col, XmlBoundElement rowElement)
1599DataRow row = args.Row;
1620private void OnColumnValuesChanged(DataRow row, XmlBoundElement rowElement)
1722private void OnNestedParentChange(DataRow child, XmlBoundElement childElement, DataColumn? childCol)
1731DataRow? parentRowInTree;
1736DataRow? parentRowInRelation = GetNestedParent(child!);
1955DataRow row = oldRowElem.Row!;
1995DataRow row = args.Row;
2053DataRow row = args.Row;
2228private void OnUndeleteRow(DataRow row, XmlElement rowElement)
2237DataRow? parentRowInRelation = GetNestedParent(row);
2377internal static void SetRowValueToNull(DataRow row, DataColumn col)
2387internal static void SetRowValueFromXmlText(DataRow row, DataColumn col, string xmlText)
2418DataRow? row = rowElement.Row;
2460DataRow row = rowElement.Row;
2552private void UpdateAllColumns(DataRow row, XmlBoundElement rowElement)
2649private bool IsRowLive(DataRow row)
2654private static void SetNestedParentRow(DataRow childRow, DataRow? parentRow)
2747DataRow row = rowElem.Row;
2809DataRow row = rowElem.Row;
2860DataRow? row = rowElement.Row;
2876DataRow? row = rowElement.Row;
2898DataRow childRow = childRowElem.Row!;
2906DataRow parentRow = parentRowElem.Row;