Select to view content in your preferred language

Recreate Relationship Class using C# / .NET for ArcGIS Pro 2.9.6

646
3
06-30-2023 06:35 AM
DusanOstojic
Emerging Contributor

I have been struggling with writing code for recreation of Relationship class in C# but I cannot swim out 😞

I need to recreate Relationship Class in FGDB using .NET  in order to change following properties of the Relationship Class:

  • Name of the relationship class
  • Origin Primary Key
  • Origin Foreign Key

I imagine some kind or process would be:

  1. Pickup existing relationship class definition using source and target table names (I tried with RelationshipClassDefinition)
  2. Change above mentioned properties (this is where I couldn’t move forward with RelationshipClassDefinition)
  3. Drop existing Relationship Class
  4. Create new relationship class with new parameters

I see that in Pro 3.1 there is RelationshipClassDescription Class with which I could easily solve the probelm, but unfortunately I need to implement this task in Pro 2.9.6.

Thanks in advance for any suggestion.

0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

SchemaBuilder object has methods for relationship management but not in 2.9.

https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic40915.html 

More documentation and samples in ProConcepts DDL

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Before release 3.0 you have to use the 'Create Relationship Class' Geoprocessing Tool in order to create a relationship class.  Since it's somewhat difficult to figure out the parameters to run a GP Tool you can follow the steps outlined in the slides for the 2023 Demo theater session (download) 'How to Run GP Tools from Your Add-in' here: Tech Sessions · ArcGIS/arcgis-pro-sdk Wiki (github.com)

0 Kudos
DusanOstojic
Emerging Contributor

Thanks for the info.

In this case I would rather implement Relationship class change in arcpy and wait for our upgrade to Pro 3.0.

0 Kudos