Chained operation with Duplicate or Split

138
2
10-12-2018 09:50 AM
MindyBurkett1
New Contributor II

When creating a feature the EditOperation.Create method allows you to specify callback to get the generated ObjectId for the newly created feature. Unfortunately, the operations like EditOperation.Duplicate and EditOperation.Split do not allow you to supply a callback to get the created ObjectId. This makes it hard to chain an operation that performs edits involving the newly-created feature.

What is the best way to get the ObjectId from a Split or Duplicate in order to perform a chained operation? 

0 Kudos
2 Replies
MindyBurkett1
New Contributor II

I implemented this using the RowCreatedEvent but this isn't ideal because I can't know for sure if a given row created event corresponds to the edit operation that interests me. I looked at the internal Operation property on the RowCreatedEventArgs but it isn't the same as my original operation.

0 Kudos
MatthewJackson3
New Contributor II

I ran across this issue when implementing a rather convoluted edit operation:

Best way, I believe, is to use an edit operation callback. Something along the lines of

var op = new EditOperation();
op.Callback((context) =>

{

   var fc = Layer.GetFeatureClass();
   var buffer = fc.CreateRowBuffer();
   var f = fc.CreateRow(buffer);
   var id = f.GetObjectID();

});