This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IR > IRelationshipClass Interface > IRelationshipClass.DeleteRelationshipsForObjectSet Method (ArcObjects .NET 10.4 SDK) |
Deletes all relationships that apply to the specified origin or destination object set.
[Visual Basic .NET] Public Sub DeleteRelationshipsForObjectSet ( _ ByVal anObjectSet As ISet _ )
[C#] public void DeleteRelationshipsForObjectSet ( ISet anObjectSet );
[C++]
HRESULT DeleteRelationshipsForObjectSet(
ISet* anObjectSet
);
[C++]
Parameters anObjectSet [in]
anObjectSet is a parameter of type ISet
The DeleteRelationshipsForObjectSet method is used for removing all relationships in a particular relationship class for the specified set of objects.
This method works in the same way as the DeleteRelationshipsForObject method, except on a set of objects rather than a single one. If a cursor is used to populate the set with objects, ensure that a non-recycling cursor is used.
This method should be called within an edit session.
//e.g., nameOfRelClass="relclass"
// nameOfOriginTable="origintable"
public void IRelationshipClass__DeleteRelationshipsForObjectSet(IWorkspace workspace, string nameOfRelClass, string nameOfOriginTable)
{
IFeatureWorkspace featureWorkspace=(IFeatureWorkspace)workspace;
IRelationshipClass relationshipClass=featureWorkspace.OpenRelationshipClass(nameOfRelClass);
ITable originTable=featureWorkspace.OpenTable(nameOfOriginTable);
ESRI.ArcGIS.esriSystem.ISet objectSet=new ESRI.ArcGIS.esriSystem.SetClass();
objectSet.Add(originTable.GetRow(1));
objectSet.Add(originTable.GetRow(2));
objectSet.Add(originTable.GetRow(3));
objectSet.Reset();
IWorkspaceEdit workspaceEdit=(IWorkspaceEdit)workspace;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
relationshipClass.DeleteRelationshipsForObjectSet(objectSet);
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);
objectSet=null;
}