English

Problem: Edits are lost when stop editing or after performing a post

Description

When editing, reconciling, or posting a version with ArcObjects, edits may be lost when stop editing or after the post operation.

Cause

Developers control the scope of all geodatabase edit operations with:

Code:
IWorkpaceEdit::StartEditOperation/StopEditOperation

or with:

Code:
IEditor.StartOperation/StopOperation

All modifications to object classes should be nested in a start and stop operation for defining clear and consistent starting and ending points for a transaction.

Operations such as IVersionEdit::Reconcile and IVersion Edit::Post may not necessarily be considered user edit operations for modifying data, but the reconcile operation does perform numerous database transactions during the merge process that must be committed to be complete.

IVersionEdit::Reconcile should be called within an edit operation and the edit operation needs to be stopped prior to calling IVersionEdit::Post. Below is an example of this:

Code:
If pConflicts = True Then
pWorkspaceEdit.AbortEditOperation
Else
pWorkspaceEdit.StopEditOperation
pVersionEdit.Post
End If

Below is an example where edits can be lost during a reconcile.

Code:
Dim pVersionEdit As IVersionEdit
Dim pConflicts As Boolean

Set pVersionEdit = pCurrentVersion

pWorkspaceEdit.StartEditing True
pWorkspaceEdit.StartEditOperation
pConflicts = pVersionEdit.Reconcile("SDE.DEFAULT")
If pConflicts = True Then
pWorkspaceEdit.AbortEditOperation
Else
pVersionEdit.Post
End If

pWorkspaceEdit.StopEditing True


A post operation is performed within the active edit operation, so changes performed by the reconcile are not committed. In the example above, stop the active edit operation prior to performing the post operation.

Note:
The above example does not include error handling. When performing a reconcile or post operation, check all error conditions. Check IVersionEdit::CanPost prior to attempting to calling IVersionEdit::Post.

Solution or Workaround

Stop all edit operations prior to performing a post operation or stop editing to ensure consistency.

    Related Information