ArcMap 9.3.1 w/ ArcFM. Using C#.

The goal is to be able to prevent certain edits based on specified business rules.

One option might seem to be looking at all operation edits in BeforeStopEditing and somehow cancelling the operation here. This is not possible as ESRI states you can't call AbortOperation here and throwing an exception does not prevent the operation from committing. Even setting a flag in BeforeStopEditing and calling UndoOperation in StopEditing if the flag is set won't work.

The obvious documented approach is to create a custom class extension and apply to all (required) tables. A given table can only have one class extension applied. Since we are using ArcFM it has applied its class extension(s) to the feature class tables. We could probably use this approach for the data tables.

We are currently using the Editor IEditEvents* to listen for feature edits, but this doesn't provide data table edits.

We are also hoping to avoid applying a custom class extension to 100's of tables, the maintenence group would not agree to that.

It's also not feasible to get all IObjectClasses and listen to each directly in the code.

The hope was to find an existing coclass or interface that broadcasts edit events for all tables. The doc's seem to suggest ObjectClassEvents may do this, but only in VB. Trying to create an instance of this in C# throws an exception (factory can't create).

Suggestions ?

  • Version 9.3.1 is a bit old. Are you just looking for edits as a part of an edit session or field calculations also? What is your workspace you want to 'protect'? fGDB, SDE.. Have a look at resources.esri.com/help/9.3/ArcGISDesktop/ArcObjects/… and resources.esri.com/help/9.3/arcgisdesktop/arcobjects/… (SDE Only) – Michael Stimson Mar 9 '15 at 0:23
  • We want to prevent edits during an edit session to an SDE workspace. I don't think IVersionEvents could be used to solve this, we want to prevent at the operation or store level, not reconcile. – Chris Kushnir Mar 9 '15 at 18:39
  • How do you define a 'good' edit and a 'bad' edit? I am fairly sure that if you know how to decide you can use your underlying database to reject an edit... using IEditWorkspace you can get the features modified, make a decision and then call undo if you don't like them. – Michael Stimson Mar 9 '15 at 21:33
  • We are trying to create a framework to support configurable biz rules on what edits are allowed, that parrt isn't a problem. the problem is getting the edit event and being able to cancel it. As mentioned we did try using undo based on the operation edits found in BeforeStopEditing but calling it from StopEditing doesn't work, it causes memory corruption. – Chris Kushnir Mar 10 '15 at 0:10
  • 1
    Yes, in a perfect world education would be enough. The client has been clear that we don't live in a perfect world. :) I think I might just have to be clear that there is a tech solution (class extension for the data tables), but it will involve touching the config for all those tables, and let them decide if it's worth it. – Chris Kushnir Mar 10 '15 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.