Share via


ISynchronousNotifyingChangeApplier2::ApplyChanges

Performs conflict detection, conflict handling, change application, and manages the conflict log for a batch of changes.

Syntax

HRESULT ApplyChanges(
  CONFLICT_RESOLUTION_POLICY resolutionPolicy,
  COLLISION_CONFLICT_RESOLUTION_POLICY collisionPolicy,
  ISyncChangeBatch * pSourceChanges,
  IUnknown * pUnkDataRetriever,
  IEnumSyncChanges * pDestinationVersions,
  ISyncKnowledge * pDestinationKnowledge,
  IForgottenKnowledge * pDestinationForgottenKnowledge,
  ISynchronousNotifyingChangeApplierTarget * pChangeApplierTarget,
  IConflictLogAccess * pConflictLogAccess,
  ISyncSessionState * pSessionState,
  ISyncCallback * pCallback);

Parameters

  • resolutionPolicy
    [in] The policy to use for resolving concurrency conflicts.

  • collisionPolicy
    [in] The policy to use for resolving collision constraint conflicts.

  • pSourceChanges
    [in] The batch of changes from the source provider.

  • pUnkDataRetriever
    [in] An object that can be used to retrieve item data from the source replica.

  • pDestinationVersions
    [in] A list of changes that contains the versions of items that are stored in the destination replica. These items correspond to the items in pSourceChanges.

  • pDestinationKnowledge
    [in] The knowledge of the destination replica.

  • pDestinationForgottenKnowledge
    [in] The forgotten knowledge of the destination replica.

  • pChangeApplierTarget
    [in] The object that will be called to save changes and conflicts.

  • pConflictLogAccess
    [in] The conflict log where deferred conflicts and temporary conflicts are stored.

  • pSessionState
    [in] State information about the current session.

  • pCallback
    [in] Callbacks that will receive notifications about change application events.

Return Value

  • S_OK

  • E_INVALIDARG when resolutionPolicy or collisionPolicy is not a valid value

  • E_OUTOFMEMORY

  • E_POINTER

  • SYNC_E_BATCH_NEEDS_KNOWLEDGE

  • SYNC_E_OBJECT_NEEDS_STATE

  • SYNC_E_CHANGE_COUNT_MISMATCH

  • SYNC_E_CHANGE_NEEDS_KNOWLEDGE

  • SYNC_E_ITEM_HAS_NO_CHANGE_UNITS

  • SYNC_E_ITEM_MUST_EXIST

  • SYNC_E_CHANGE_NOT_IN_KNOWLEDGE

  • SYNC_E_CHANGE_UNIT_COUNT_MISMATCH

  • SYNC_E_KNOWLEDGE_DECREASED

  • SYNC_E_NOT_EXPECTED_CHANGE

Remarks

Typically, this method is called by a provider from its IKnowledgeSyncProvider::ProcessChangeBatch method.

This method detects concurrency conflicts that occur between the changes that are sent in pSourceChanges and the corresponding items in the destination replica. It resolves any concurrency conflicts according to the policy specified by resolutionPolicy. When collision constraint conflicts are reported by the destination provider, this method resolves them according to the policy specified by collisionPolicy. If no conflict resolution policy is set, this method notifies the application of a conflict, and the application specifies a conflict resolution action. If it is necessary, this method then calls methods on pChangeApplierTarget to save changes to the destination replica and to save unresolved conflicts.

If pDestinationVersions is NULL, Sync Framework calls IASynchronousNotifyingChangeApplierTarget::GetDestinationVersion on pChangeApplierTarget for each item in pSourceChanges.

The change applier helps manage the conflict log specified by pConflictLogAccess, by resolving conflicts in the log and removing obsolete conflicts from the log. The change applier may also use the conflict log to store temporary conflicts that occur as a result of merging constraint conflicts. Any temporary conflicts added to the log will be removed before the synchronization session ends.

See Also

Reference

ISynchronousNotifyingChangeApplier2 Interface

Concepts

Handling Conflicts