ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / ReconcileOptions Class
Members Example

In This Topic
    ReconcileOptions Class
    In This Topic
    Represents a mechanism to reconcile a Version.
    Object Model
    ReconcileOptions ClassVersion Class
    Syntax
    Public NotInheritable Class ReconcileOptions 
    public sealed class ReconcileOptions 
    Example
    Reconciling and Posting a Version with its Parent in separate edit sessions
    {
      // Must be called within QueuedTask.Run
      void ReconcileAndPost(Geodatabase geodatabase)
      {
        // Get a reference to our version and our parent
        if (geodatabase.IsVersioningSupported())
        {
          using (VersionManager versionManager = geodatabase.GetVersionManager())
          using (Version currentVersion = versionManager.GetCurrentVersion())
          using (Version parentVersion = currentVersion.GetParent())
          {
            // Create a ReconcileOptions object
            ReconcileOptions reconcileOptions = new ReconcileOptions(parentVersion);
            reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
            reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
            reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion; //or FavorEditVersion
    
            // Reconcile
            ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions);
            if (!reconcileResult.HasConflicts)
            {
              //No conflicts, perform the post
              PostOptions postOptions = new PostOptions(parentVersion);
              //var postOptions = new PostOptions(); for default version
              postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous; //Default
    
              // Post - Deprecated since Pro SDK 3.6 / Enterprise 12.0 . Use Reconcile(reconcileOptions, postOptions) instead.
              // currentVersion.Post(postOptions);
    
              currentVersion.Reconcile(reconcileOptions, postOptions);
            }
          }
        }
      }
    }
    Reconciling and Posting a Version with its Parent in the same edit session
    {
      // Must be called within QueuedTask.Run
      void ReconcileAndPost2(Geodatabase geodatabase)
      {
        // Get a reference to our version and our parent
        if (geodatabase.IsVersioningSupported())
        {
          using (VersionManager versionManager = geodatabase.GetVersionManager())
          using (Version currentVersion = versionManager.GetCurrentVersion())
          using (Version parentVersion = currentVersion.GetParent())
          {
            // Create a ReconcileOptions object
            ReconcileOptions reconcileOptions = new ReconcileOptions(parentVersion);
            reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue; // continue if conflicts are found
            reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByRow; //Default
            reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorTargetVersion; //or FavorEditVersion
    
            PostOptions postOptions = new PostOptions(parentVersion);
            //var postOptions = new PostOptions(); for default version
            postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous; //Default
    
            // Reconcile
            ReconcileResult reconcileResult = currentVersion.Reconcile(reconcileOptions, postOptions);
            if (reconcileResult.HasConflicts)
            {
              //TODO resolve conflicts
            }
          }
        }
      }
    }
    Partial Posting
    {
      // Must be called within QueuedTask.Run
      void PartialPostingSnippet(Version designVersion, FeatureClass supportStructureFeatureClass, List<long> deletedSupportStructureObjectIDs)
      {
        // Partial posting allows developers to post a subset of changes made in a version.
        // One sample use case is an electric utility that uses a version to design the facilities in
        // a new housing subdivision. At some point in the process, one block of new houses have been
        // completed, while the rest of the subdivision remains unbuilt.  Partial posting allows the user
        // to post the completed work, while leaving not yet constructed features in the version to be
        // posted later. Partial posting requires a branch-versioned feature service using ArcGIS
        // Enterprise 10.9 and higher
    
        // Specify a set of features that were constructed
        QueryFilter constructedFilter = new QueryFilter()
        {
          WhereClause = "ConstructedStatus = 'True'"
        };
        // This selection represents the inserts and updates to the support
        // structure feature class that we wish to post
        using (Selection constructedSupportStructures = supportStructureFeatureClass.Select(constructedFilter, SelectionType.ObjectID,
                 SelectionOption.Normal))
        {
          // Specifying which feature deletions you wish to post is slightly trickier, since you cannot issue
          // a query to fetch a set of deleted features Instead, a list of ObjectIDs must be used
          using (Selection deletedSupportStructures = supportStructureFeatureClass.Select(null, SelectionType.ObjectID, SelectionOption.Empty))
          {
            deletedSupportStructures.Add(deletedSupportStructureObjectIDs); //deletedSupportStructureObjectIDs is defined as List<long>
    
            // Perform the reconcile with partial post
            ReconcileOptions reconcileOptions = new ReconcileOptions(); // Reconcile against Default
            reconcileOptions.ConflictDetectionType = ConflictDetectionType.ByColumn;
            reconcileOptions.ConflictResolutionMethod = ConflictResolutionMethod.Continue;
            reconcileOptions.ConflictResolutionType = ConflictResolutionType.FavorEditVersion;
    
            /*
            PostOptions postOptions = new PostOptions(); 
            
            // PartialPostSelections - Deprecated since Pro SDK 3.7. Use PartialPostOptions instead. 
            postOptions.PartialPostSelections = new List<Selection>()
              {
                constructedSupportStructures, deletedSupportStructures
              };
            postOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;
            */
    
            PartialPostOptions partialPostOptions = new PartialPostOptions(); // Partial post against the Default
            partialPostOptions.Selections = new List<Selection>()
            {
              constructedSupportStructures, deletedSupportStructures
            };
            partialPostOptions.ServiceSynchronizationType = ServiceSynchronizationType.Synchronous;
    
            ReconcileResult reconcileResult = designVersion.Reconcile(reconcileOptions, partialPostOptions);
    
            // Use the reconcileResult ...
          }
        }
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.ReconcileOptions

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also