AnsweredAssumed Answered

Is it possible to add an AttributedRelationshipClass Table to the map with esriDatasetType.esriDTRelationshipClass?

Question asked by nagelkerket on Sep 18, 2020
Latest reply on Oct 4, 2020 by nagelkerket

ArcGIS Pro version: 2.5

 

I have created a filegeodatabase with 2 Feature Classes and 1 Relationship Class with a Table (AttributedRelationshipClass). 

The AttributedRelationshipClass defines the link between those two featurelayers using GUIDs and a few properties for the relation. 

 

I used the ArcGis Pro sdk (c#) to add the feature classes to the map: 

var map = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(e => e.Name == name);

var lyrDocFromLyrxFile = new LayerDocument(layerFile);
var cimLyrDoc = lyrDocFromLyrxFile.GetCIMLayerDocument();
var lcp = new LayerCreationParams(cimLyrDoc);
LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map, LayerPosition.AutoArrange);

 

I tried to add the table with: 

 

using (var table = geodatabase.OpenDataset<Table>(relationshipName))
{
StandaloneTableFactory.Instance.CreateStandaloneTable(table, map, table.GetName());
}

The datatype is then: esriDatasetType.esriDTTable.

This resulted in these warnings: 

 

 

When I right click on the warning I get the option to add the table to the map. Then the table is added in the correct way with the datatype: esriDatasetType.esriDTRelationshipClass. 

 

Is it possible to do this with the ArcGIS Pro .NET sdk?

 

Thanks,

Tim

Outcomes