This document is archived and information here might be outdated.  Recommended version.


Reconciling versions (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with feature data > Versioning > Reconciling versions (ArcObjects .NET 10.6 SDK)

Reconciling versions


Summary
At any time, the changes in source version can be reconciled with any ancestor version, such as the parent or default version. To reconcile changes, the source version must be explicitly reconciled with a target version. This topic discusses the available options when reconciling.

In this topic


About reconciling versions

The IVersionEdit4 interface contains the Reconcile4 method with the following five arguments:
  • VersionName
  • acquireLock
  • abortIfConflicts
  • ChildWins
  • columnLevel
Each argument affects how the reconcile is performed. It is important to understand the impact of the different property values and influence they have on the reconcile process.

VersionName

The VersionName property is the name of the target version that the source version is reconciled against. The target version must be an ancestral version, for example, the immediate parent version or default version.

acquireLock

The default behavior of reconcile is to obtain a shared version lock on the target version. The lock ensures the target version cannot be reconciled while the source version can be reconciled. The purpose of the version lock on the target version is to ensure the version is available when the intention is to post. If the intention is not to post to the target version following a reconcile, the acquireLock parameter can be set to false.

abortIfConflicts

It is also possible to abort the reconcile when a conflict is detected. Setting the abortIfConflicts to true aborts the reconcile process when conflicts are detected; for example, this can be used when performing the reconcile in a batch process without human interaction to resolve the conflicts.

ChildWins

If conflicts occur, the conflicts are initially resolved in favor of the target version. Setting this argument to true replaces all conflicting features with the source version's representation of the object.

columnLevel

The reconcile method also provides the ability to define what constitutes a conflict during the reconcile. The columnLevel argument is a Boolean argument that if set to true, only promotes the same modified object in both versions as a conflict if the same attribute for the object has changed in both versions. For example, if a feature was moved in the target version, the same feature's attribute was updated in the edit version, and if column level conflict filtering was set to true, the reconcile would not detect this feature as a conflict.
The following code example shows how reconcile can be used in a versioned edit session:
[C#]
public void ReconcileandPost(IVersion editVersion, IVersion targetVersion)
{
    IMultiuserWorkspaceEdit muWorkspaceEdit=(IMultiuserWorkspaceEdit)editVersion;
    IWorkspaceEdit workspaceEdit=(IWorkspaceEdit2)editVersion;
    IVersionEdit4 versionEdit=(IVersionEdit4)workspaceEdit;

    if (muWorkspaceEdit.SupportsMultiuserEditSessionMode
        (esriMultiuserEditSessionMode.esriMESMVersioned))
    {
        muWorkspaceEdit.StartMultiuserEditing
            (esriMultiuserEditSessionMode.esriMESMVersioned);
        //Reconcile with the target version.
        bool conflicts=versionEdit.Reconcile4(targetVersion.VersionName, true,
            false, false, false);
        if (conflicts)
            MessageBox.Show(" Conflicts Detected ");
        else
            MessageBox.Show(" No Conflicts Detected ");
        workspaceEdit.StartEditOperation();
        //Post to the target version.
        if (versionEdit.CanPost())
            versionEdit.Post(targetVersion.VersionName);
        workspaceEdit.StopEditOperation();
        workspaceEdit.StopEditing(true);
    }
}
[VB.NET]
Public Sub ReconcileAndPost(ByVal editVersion As IVersion, ByVal targetVersion As IVersion)
    Dim muWorkspaceEdit As IMultiuserWorkspaceEdit=CType(editVersion, IMultiuserWorkspaceEdit)
    Dim workspaceEdit As IWorkspaceEdit=CType(editVersion, IWorkspaceEdit2)
    Dim versionEdit As IVersionEdit4=CType(workspaceEdit, IVersionEdit4)
    
    If muWorkspaceEdit.SupportsMultiuserEditSessionMode(esriMultiuserEditSessionMode.esriMESMVersioned) Then
        
        muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned)
        Dim conflicts As Boolean=versionEdit.Reconcile4(targetVersion.VersionName, True, False, False, False)
        
        If conflicts Then
            MessageBox.Show(" Conflicts Detected ")
        Else
            MessageBox.Show(" No Conflicts Detected ")
        End If
        
        workspaceEdit.StartEditOperation()
        
        If versionEdit.CanPost Then
            versionEdit.Post(targetVersion.VersionName)
        End If
        
        workspaceEdit.StopEditOperation()
        workspaceEdit.StopEditing(True)
        
    End If
End Sub

Using RecommendedReconcileOrder on IVersionedWorkspace2

The RecommendedReconcileOrder property returns an enumerator of version names based on the ascending order of each version's common ancestor state with respect to the default version. If a version's common ancestor state is equal to or greater than the state the default version references, it will not be included in the enumerator.
The property is intended to be used before running a compress. If all or some of the versions returned by RecommendedReconcileOrder are reconciled based on the enumerator's order, the compress operation can move more rows from a table's versioned delta tables to the base tables. The more versions reconciled based on the order of versions returned, the more rows will be compressed to the base table.






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):

Development licensing Deployment licensing
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine: Geodatabase Update