[GIS] Is it possible to undo and redo outside edit session in ArcObjects

arcgis-10.1arcobjectsenterprise-geodatabaseundo/redoversioning

I would like to know if it is possible to undo and redo changes outside of an edit session?

If yes, how can I do it in ArcObjects using .NET?

I am working on an ArcSDE 10.1 versioned geodatabase?

Best Answer

Undoing edits in ArcObjects without an edit session is not possible. Redo is only available in a versioned edit session. Nonversioned edit session only have save (commit) or don't save (rollback).

Any edits made outside an edit session are immediately commited to the database. Furthermore, for nonversioned edits, certain geodatabase functionality prevents editing without an edit session. For versioned feature class, I don't think ArcObjects will allow you to make any edit without an edit session.

You COULD run your own sql through IWorksapce.ExecuteSQL. You COULD run update statments and whatever else you would like. The downside of this is that ArcObjects may commit your changes with any DDL, metadata update or random commit that it may perform.

If you want to undo an entire versioned edit session, you will need to know what the state_id of the session was before you made your first edit. If you wanted to do this from pure ArcObjects, you could create a new version before starting your edit session. Do your edit, and save your session. At that point you would have one version pointing to the original state, and another pointing the to the new state. If you wanted to "undo" the edit, connect to the old version, and delete the new version.

Is there a reason you don't want to use an edit session?