ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Data Namespace / Geodatabase Class / OpenRelationshipClasses Method / OpenRelationshipClasses(String,String) Method
The name of the origin table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetOriginClass. For feature service geodatabases, this should be a layer ID or the name of the table as it is exposed through the feature service (e.g., "L0States").
The name of the destination table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetDestinationClass. For feature service geodatabases, this should be a layer ID or the name of the table as it exposed through the feature service (e.g., "L1Counties").
Example

In This Topic
    OpenRelationshipClasses(String,String) Method
    In This Topic
    Gets a IReadOnlyList of specific RelationshipClass or AttributedRelationshipClass instances associated with the originClass and the destinationClass where originClass is the origin table/feature class and destinationClass is the destination table/feature class. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Function OpenRelationshipClasses( _
       ByVal originClass As String, _
       ByVal destinationClass As String _
    ) As IReadOnlyList(Of RelationshipClass)

    Parameters

    originClass
    The name of the origin table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetOriginClass. For feature service geodatabases, this should be a layer ID or the name of the table as it is exposed through the feature service (e.g., "L0States").
    destinationClass
    The name of the destination table/feature class in the relationship. This value can be obtained by calling RelationshipClassDefinition.GetDestinationClass. For feature service geodatabases, this should be a layer ID or the name of the table as it exposed through the feature service (e.g., "L1Counties").

    Return Value

    Exceptions
    ExceptionDescription
    No valid geodatabase has been opened prior to calling this operation.
    originClass or destinationClass is null or an empty string.
    A geodatabase-related exception has occurred.
    Remarks
    This routine works with regular RelationshipClasses as well as AttributedRelationshipClasses.
    Example
    Opening RelationshipClass between two Tables
    // Must be called within QueuedTask.Run().  
    // When used with file or enterprise geodatabases, this routine takes two table names.
    // When used with feature services, this routine takes layer IDs, or the names of the tables as they are exposed through the service (e.g., "L0States")
    public IReadOnlyList<RelationshipClass> OpenRelationshipClassFeatureServices(Geodatabase geodatabase, string originClass, string destinationClass)
    {
      return geodatabase.OpenRelationshipClasses(originClass, destinationClass);
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also