RemoveRelation Method
Removes a relation from the observable data set by name. This is useful when a workflow dynamically builds schemas (for example, a plugin adds optional child tables) and later needs to tear them down or replace them.
This method delegates to the underlying POCO IDataSet.RemoveRelation and returns a boolean indicating
whether a relation with the given name existed and was removed.
/// <summary>
/// Removes relation by name
/// IObservableDataSet interface implementation
/// </summary>
/// <param name="relationName">Relation name</param>
/// <returns>Flag indicating whether relation was removed</returns>
public bool RemoveRelation(string relationName)
Namespace: PocoDataSet.ObservableData
Assembly: PocoDataSet.ObservableData.dll
// 1. Create observable dataset
IObservableDataSet observableDataSet = new ObservableDataSet();
// 2. Add parent Customer table with Id primary key
IObservableDataTable customerObservableDataTable = observableDataSet.AddNewTable("Customer");
customerObservableDataTable.AddColumn("Id", DataTypeNames.INT32);
customerObservableDataTable.AddColumn("Name", DataTypeNames.STRING);
// 3. Add child Order table with CustomerId foreign key
IObservableDataTable orderObservableDataTable = observableDataSet.AddNewTable("Order");
orderObservableDataTable.AddColumn("Id", DataTypeNames.INT32);
orderObservableDataTable.AddColumn("CustomerId", DataTypeNames.INT32, false, false, true);
orderObservableDataTable.AddColumn("Status", DataTypeNames.STRING);
// 4. Add relation between Customer and Order tables: Customer.Id -> Order.CustomerId
observableDataSet.AddRelation("CustomerOrder", "Customer", "Id", "Order", "CustomerId");
// 5. Call RemoveRelation method to remove relation between Customer and Order tables
bool removed = observableDataSet.RemoveRelation("CustomerOrder");
Table of Content POCO DataSet API References ObservablePOCO DataSet Types ObservableDataSet 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.