ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / AddRelationshipClass Method / AddRelationshipClass(FeatureDatasetDescription,RelationshipClassDescription) Method
Indicates the ArcGIS.Core.Data.FeatureDataset where the ArcGIS.Core.Data.RelationshipClass will be added.
Indicates the ArcGIS.Core.Data.RelationshipClass to add.
Example Version

AddRelationshipClass(FeatureDatasetDescription,RelationshipClassDescription) Method
Enqueue the Add operation on the object referred to by the FeatureDatasetDescription and the RelationshipClassDescription.
Syntax

Parameters

featureDatasetDescription
Indicates the ArcGIS.Core.Data.FeatureDataset where the ArcGIS.Core.Data.RelationshipClass will be added.
relationshipClassDescription
Indicates the ArcGIS.Core.Data.RelationshipClass to add.
Exceptions
ExceptionDescription
The relationship split policy and/or the relationship rules are invalid.
featureDatasetDescription and/or relationshipClassDescription is null.
Memory ArcGIS.Core.Data.Geodatabase does not support relationship classes.
The relationship split policy is not supported.
Example
Adding/Removing Relationship class in/out of a feature dataset
public void MoveRelationshipClass(SchemaBuilder schemaBuilder, FeatureDatasetDefinition featureDatasetDefinition, RelationshipClassDefinition relationshipClassDefinition)
{
    FeatureDatasetDescription featureDatasetDescription = new FeatureDatasetDescription(featureDatasetDefinition);
    RelationshipClassDescription relationshipClassDescription = new RelationshipClassDescription(relationshipClassDefinition);

    // Remove relationship class from the feature dataset
    schemaBuilder.RemoveRelationshipClass(featureDatasetDescription, relationshipClassDescription);

    // Add relationship class inside the feature dataset
    // schemaBuilder.AddRelationshipClass(featureDatasetDescription, relationshipClassDescription);

    schemaBuilder.Build();
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.1 or higher.
See Also