Hi -
The code below attempts to create an association between two utility network features within a HandleEditCompletedEvent. As it is, it consistently throws an error when attempting to add the association, line:
_un.AddAssociation(assoc)
The error message states that "This task must be performed within an Edit Operation" - but the AddAssociation *is* performed within an edit operation.
Now, it may be that what I'm trying to do -- perform an edit to create an association within an edit event fired on creation of a feature that would be part of that association -- is just not supported. But that's not what the error says.
Anyway, any guidance on this would be much appreciated.
Thx,
Ed
------------------------------------------------------------------------
Hello,
You cannot add a new edit operation within an EditCompleted event. To add your associations you should subscribe to the RowCreatedEvent for the datasets you are interested in and place your code there. Make sure to use the EditOperation that is passed in the RowChangedEventArgs of the row created event handler. This ensures that the association created is part of the same ongoing edit transaction as the element creation and will be part of the same undo / redo item.
Here is some additional information on the edit events and row events specifically - https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#edit-events and https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#row-events
Narelle
Hi Narelle -
Thanks for the feedback! I'll definitely check out the info provided.
Ed