CreateFloatingRow Method
The CreateFloatingRow method creates a new floating (sparse) data row.
A floating row initially contains no fields. Fields are considered provided only when they are explicitly assigned.
This method is a foundational building block for delta (PATCH-style) changesets,
where only primary keys and explicitly modified fields should be transmitted or applied.
It allows POCO DataSet to distinguish between
a field that is missing and a field that is explicitly set to null.
/// <summary>
/// Creates a floating (sparse) row. The row initially contains no fields.
/// Fields become "provided" only when explicitly set.
/// </summary>
/// <param name="initialCapacity">Optional initial capacity for internal storage.</param>
/// <returns>Created floating row.</returns>
public static IFloatingDataRow CreateFloatingRow(int initialCapacity = 0)
Namespace: PocoDataSet.Extensions
Assembly: PocoDataSet.Extensions.dll
null.
// 1. Create floating data row and observe that it has no fields
IFloatingDataRow floatingDataRow = DataRowExtensions.CreateFloatingRow();
// Add any field of any type according to the business needs by assigning values to floating data row
// Add FirstName field type of string
floatingDataRow["FirstName"] = "Sara";
// Add DepartmentId field type of int
floatingDataRow["DepartmentId"] = 2;
// Add DateOfBirth field with null value
floatingDataRow["DateOfBirth"] = null;
// and so on...
// Floating data row can be added to any table because its schema doesn't bound to the schema of any table
// 2. Create data set
IDataSet dataSet = DataSetFactory.CreateDataSet();
// 3. Create Employee data table
IDataTable employmentTypeDataTable = dataSet.AddNewTable("Employee");
employmentTypeDataTable.AddColumn("Id", DataTypeNames.INT32);
employmentTypeDataTable.AddColumn("FirstName", DataTypeNames.STRING);
employmentTypeDataTable.AddColumn("LastName", DataTypeNames.STRING);
// 4. Add floating row to Employee data table and observe that floating data row still contains
// "DepartmentId" and "DateOfBirth" fields despite the table schema doesn't define them.
// Observe that floating data row does not contain "LastName" field despite table schema defines it
employmentTypeDataTable.AddRow(floatingDataRow);
AddNewRow are preferred for UI baselines.CreateChangeset.Table of Content POCO DataSet DataRow Members
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.