ArcObjects Library Reference (GeoDatabase)  

IRelationshipClass.DeleteRelationshipsForObjectSet Method

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

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

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.

[C#]

    //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;
    }

See Also

IRelationshipClass Interface