RemoveRelation Method
The RemoveRelation method removes a relation from data set by relation name.
/// <summary>
/// Removes relation from data set
/// </summary>
/// <param name="relationName">Relation name</param>
public void RemoveRelation(string relationName)
Namespace: PocoDataSet.Data
Assembly: PocoDataSet.Data.dll
// 1. Create new data set
IDataSet dataSet = DataSetFactory.CreateDataSet();
// 2. Add parent Customer table with Id primary key
IDataTable customerDataTable = dataSet.AddNewTable("Customer");
customerDataTable.AddColumn("Id", DataTypeNames.INT32, false, true);
customerDataTable.AddColumn("Name", DataTypeNames.STRING);
// 3. Add child Order table with CustomerId foreign key
IDataTable orderDataTable = dataSet.AddNewTable("Order");
orderDataTable.AddColumn("Id", DataTypeNames.INT32, true);
orderDataTable.AddColumn("CustomerId", DataTypeNames.INT32, false, false, true);
orderDataTable.AddColumn("Status", DataTypeNames.STRING);
// 4. Add relation between Customer and Order tables: Customer.Id -> Order.CustomerId
dataSet.AddRelation("CustomerOrder", "Customer", "Id", "Order", "CustomerId");
// Now relation navigation works (see GetChildRows / TryGetParentRow docs).
bool hasRelation = dataSet.ContainsRelation("CustomerOrder"); // true
// 5. Call RemoveRelation method to remove relation from data set
dataSet.RemoveRelation("CustomerOrder");
// Observe that relation was removed from data set.
bool hasRelation = dataSet.ContainsRelation("CustomerOrder"); // flase
Table of Content POCO DataSet API References POCO DataSet Types DataSet 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.