DataRow Members
Properties
Contract: IDataRow interface in PocoDataSet.IData library
Implementation: DataRow class in PocoDataSet.Data library
-
DataRowState
Allows you to get the state of a row but cannot be set directly by application code.
State transitions are managed internally by the POCO DataSet framework based on row operations (Add, Modify, Delete, AcceptChanges, RejectChanges).
-
HasOriginalValues
Indicates whether a data row currently holds a snapshot of its original (baseline) values.
This snapshot is created automatically by the framework when an unchanged row is modified for the first time, or when the Delete method is called.
-
OriginalValues
Provides read-only access to the baseline values of a data row, captured at the moment the row first transitions away from the Unchanged state.
-
Selected
Allows you to get or set a flag indicating whether a row is selected. This property is primarily intended for use in the presentation layer of applications.
Typical use cases include UI selection, highlighting, or interaction state in data-bound controls such as grids, lists, or tree views.
The Selected property does not affect the row’s DataRowState, change tracking, or persistence behavior.
It is not considered part of the row’s data and is ignored by AcceptChanges, RejectChanges, and merge operations.
-
Values
The Values property returns a read-only view of the row current field values.
Indexers
Contract: IDataRow interface in PocoDataSet.IData library
Implementation: DataRow class in PocoDataSet.Data library
-
Indexer
Allows you to get or set the current value of a row data field by column name. This indexer provides convenient access to row values using array-like syntax.
Reading a value using the indexer returns null if the specified column does not exist or if the stored value is null.
Writing a value using the indexer updates the row value and may change the row’s DataRowState.
If the row is in the Unchanged state, assigning a different value causes the framework to capture original values and mark the row as Modified.
Methods
Contract: IDataRow interface in PocoDataSet.IData library
Implementation: DataRow class in PocoDataSet.Data library
-
AcceptChanges
Accepts the row current values as the new baseline and sets the row state to Unchanged (when applicable).
If the current state of the row is Detached or Unchanged, the AcceptChanges method does nothing.
If the current state of the row is Deleted then AcceptChanges method throws an exception because accepting changes means
the deleted row must be removed from the table it belongs to, but that action can be done at table level only.
If the current state of the row is Added or Modified then the AcceptChanges method changes the row's state to Unchanged.
For Added and Modified rows, AcceptChanges method discards any stored original-value snapshot and makes current values the baseline.
-
ContainsKey
Allows you to check whether a row contains a value for the specified column name.
The ContainsKey method checks only for the presence of the specified column name in the row. It does not indicate whether the associated value is non-null.
-
Delete
Marks a row for deletion. The method changes the row state to Deleted and captures original values if they are not already captured.
-
RejectChanges
Reverts a row to its baseline (original) values captured by the framework. The method behaves differently depending on the current state of the row.
If the current state of the row is Detached or Unchanged then RejectChanges method does nothing.
If the current state of the row is Added, the RejectChanges method throws an exception because
"reject changes" means added row needs to be removed from the table it was added to, but that action must be performed at table level.
If the current state of the row is Deleted or Modified then the RejectChanges method restores row values
from the snapshot if it exists and changes the row's state to Unchanged. If no snapshot exists, it still sets state to Unchanged and clears snapshot.
-
TryGetOriginalValue
Allows you to get the baseline (original) value of data field by column name from the row original-values snapshot, if such a snapshot exists.
-
TryGetValue
Allows you to get the current value of data field by column name. The method returns true when the row contains the specified data field, otherwise it returns false and outputs null.
Extension Methods
Implementation: classes in PocoDataSet.Extensions library
-
AsInterface
Creates a live proxy for an IDataRow that implements a POCO interface (TInterface).
Getting and setting properties on the returned interface reads and updates the underlying data row fields.
-
CopyFrom
Copies values from a source data row into a current data row using an explicit list of column metadata. Only columns defined in the metadata list are considered.
If the source row does not contain a value for a column defined in the metadata list, that column is skipped.
If the current row does not contain the column but the source row does, the column is added to the current row, enabling schema evolution.
-
CopyFromPoco
Copies values from a POCO object into an data row by reading all public instance properties that have a getter.
Each readable property value is assigned to the data row field with the same column name as the property name.
This method does not validate that the POCO structure matches the row schema. For predictable results, ensure that the row contains fields for the POCO properties.
-
CopyToPoco
Copies values from an data row into an existing Plain Old CLR Object (POCO) instance.
Property matching between the data row and the POCO is performed in a case-insensitive manner. Only values present in the data row are applied.
-
CreateFloatingRow
Creates a new floating (sparse) data row. A floating row initially contains no fields. Fields are considered provided only when they are explicitly assigned.
-
CreateRowFromColumns
Ccreates a new data row instance from a list of column metadata. The created row contains one data field per column name and all data fields are initialized to null.
Created data row is not associated with any data table.
-
CreateRowFromColumnsWithDefaultValues
Creates a new data row instance from a list of column metadata. The created row contains one data field per column initialized with default values
(for example, 0 for numeric types). Created data row is not associated with any data table.
-
EnumerateValues
Returns an enumerable sequence of all data field values in a data row as KeyValuePair items, where the key is the column name and the value is the current data field value.
-
GetDataFieldValue
Reads a value from an data row field and returns it as a strongly typed value.
If the raw value is not already of the requested type, the method attempts to convert it using the framework composite value converter.
This method is intentionally tolerant: if conversion is not possible, it returns default(T) instead of throwing.
The only exception case is when the requested data field does not exist in the row.
-
ToPoco
Creates a new POCO object of type T and copies values from a data row into the POCO’s public writable properties.
The created POCO object is a detached copy: it is not linked to the underlying row, and changes made to the POCO are not reflected in the row.
-
TryGetFieldKeyByColumnName
Helps to resolve the actual field key used inside a data row when you only know a column name.
This is particularly useful when field keys are stored with a specific casing (for example, "FirstName") but callers may provide a different casing (for example, "firstname").
Table of Content
POCO DataSet
API References
POCO DataSet Types
Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the
Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate
credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness
or suitability of the information and are not responsible for any damages
resulting from its use.