ArcGIS Pro 3.4 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 Version

OpenRelationshipClasses(String,String) Method
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

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