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


IReplicationAgent.SynchronizeReplica Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (GeoDatabaseDistributed)  

IReplicationAgent.SynchronizeReplica Method

Synchronizes a replica pair.

[Visual Basic .NET]
Public Function SynchronizeReplica ( _
    ByVal gds1 As IGeoDataServer, _
    ByVal gds2 As IGeoDataServer, _
    ByVal rep1 As IGPReplica, _
    ByVal rep2 As IGPReplica, _
    ByVal pol As esriReplicationAgentReconcilePolicy, _
    ByVal dir As esriReplicaSynchronizeDirection, _
    ByVal columnLevel As Boolean _
) As Boolean
[C#]
public bool SynchronizeReplica (
    IGeoDataServer gds1,
    IGeoDataServer gds2,
    IGPReplica rep1,
    IGPReplica rep2,
    esriReplicationAgentReconcilePolicy pol,
    esriReplicaSynchronizeDirection dir,
    bool columnLevel
);
[C++]
HRESULT SynchronizeReplica(
  IGeoDataServer* gds1,
  IGeoDataServer* gds2,
  IGPReplica* rep1,
  IGPReplica* rep2,
  esriReplicationAgentReconcilePolicy pol,
  esriReplicaSynchronizeDirection dir,
  VARIANT_BOOL columnLevel,
  VARIANT_BOOL* conflictsDetected
);
[C++]

Parameters gds1 [in]
gds1 is a parameter of type IGeoDataServer gds2 [in]
gds2 is a parameter of type IGeoDataServer rep1 [in]
rep1 is a parameter of type IGPReplica rep2 [in]
rep2 is a parameter of type IGPReplica pol [in]
pol is a parameter of type esriReplicationAgentReconcilePolicy dir [in]
dir is a parameter of type esriReplicaSynchronizeDirection columnLevel [in] columnLevel is a parameter of type VARIANT_BOOL conflictsDetected [out, retval] conflictsDetected is a parameter of type VARIANT_BOOL

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The SynchronizeReplica method provides a way to synchronize changes between a replica pair in a connected environment. This method may be used with check-out replicas, two way replicas, or one way replicas. If you are using replication in a disconnected environment, where the replicas are not on the same network, you must use the IGeoDataServer interface to synchronize changes. Please see the GeoDataServer coclass for more information.

The SynchronizeReplica method requires two input geodataserver objects, gds1 and gds2. One geodataserver must reference the geodatabase with the parent replica and the other the geodatabase with the child replica. The order is not important. For example, if gds1 references the child, gds2 would reference the parent or vice versa.

The rep1 and rep2 parameters take GPReplica objects for the parent and child replicas. See the GPReplica coclass for more information. These parameters must be consistent with the ordering of the geodataserver objects passed in for gds1 and gds2. For example, if gds1 refers to the geodatabase with the parent replica then rep1 must reference the parent replica. The gds2 and rep2 parameters in the same way must then refer to the child replica.

During synchronization, changes are first applied to a synchronization version. For 2 way and 1 way replicas, this version is always reconciled and posted with the replica version. For check-out replicas, you can choose whether or not to reconcile and post. The pol parameter takes an esriReplicationAgentReconilePolicy enumeration value to determine how conflicts will be handled during reconcile. See the esriReplicationAgentReconcilePolicy enumeration for more information.  The following describes the meaning of each enumeration:

esriRADetectConflicts -If conflicts occur, the reconcile process is aborted and you must reconcile and post manually after sycnhronization is completed. 

esriRAResolveConflictsInFavorOfReplica1 - Automatically reconcile in favor of rep1 if conflicts arrise.

esriRAResolveConflictsInFavorOfReplica2 - Automatically reconcile in favor of rep2 if conflicts arrise.

esriRAResolveConflictsNone - This enumeration has meaning for check-out replicas only. It indicates that a the synchronization version should not be reconciled and post with the replica version during synchronization

The dir parameter takes an esriReplicaSynchronizeDirection enumeration value to define the direction to synchronize the changes.  See esriReplicaSynchronizeDirection for more information.

If synchronizing in both directions, the reconcile policy set with the pol parameter will apply to both synchronizations. Therefore you must set the pol parameter to either resolve conflicts in favor of rep1 or resolve in favor of rep2.  An error occurs if you specify any other policy when synchronizing in both directions.

The method returns TRUE if conflicts were detected. It returns FALSE if no conflicts were detected.


 

[C#]

The How to synchronize a replica in a connected environment topic describes how to synchronize a replica using this method.

See Also

IReplicationAgent Interface

.NET Related Topics

How to synchronize a replica in a connected environment