ApplyChanges 方法 (ConflictResolutionPolicy, CollisionConflictResolutionPolicy, ChangeBatch, IChangeDataRetriever, SyncKnowledge, ForgottenKnowledge, INotifyingChangeApplierTarget, IConflictLogAccess, SyncSessionContext, SyncCallbacks)

对变更批执行冲突检测、并发冲突处理、约束冲突处理、变更应用以及冲突日志管理。

命名空间:  Microsoft.Synchronization
程序集:  Microsoft.Synchronization(在 Microsoft.Synchronization.dll 中)

语法

声明
Public Sub ApplyChanges ( _
    resolutionPolicy As ConflictResolutionPolicy, _
    collisionConflictResolutionPolicy As CollisionConflictResolutionPolicy, _
    sourceChanges As ChangeBatch, _
    changeDataRetriever As IChangeDataRetriever, _
    destinationKnowledge As SyncKnowledge, _
    destinationForgottenKnowledge As ForgottenKnowledge, _
    changeApplierTarget As INotifyingChangeApplierTarget, _
    conflictLogAccess As IConflictLogAccess, _
    syncSessionState As SyncSessionContext, _
    syncCallback As SyncCallbacks _
)
用法
Dim instance As NotifyingChangeApplier
Dim resolutionPolicy As ConflictResolutionPolicy
Dim collisionConflictResolutionPolicy As CollisionConflictResolutionPolicy
Dim sourceChanges As ChangeBatch
Dim changeDataRetriever As IChangeDataRetriever
Dim destinationKnowledge As SyncKnowledge
Dim destinationForgottenKnowledge As ForgottenKnowledge
Dim changeApplierTarget As INotifyingChangeApplierTarget
Dim conflictLogAccess As IConflictLogAccess
Dim syncSessionState As SyncSessionContext
Dim syncCallback As SyncCallbacks

instance.ApplyChanges(resolutionPolicy, _
    collisionConflictResolutionPolicy, _
    sourceChanges, changeDataRetriever, _
    destinationKnowledge, destinationForgottenKnowledge, _
    changeApplierTarget, conflictLogAccess, _
    syncSessionState, syncCallback)
public void ApplyChanges(
    ConflictResolutionPolicy resolutionPolicy,
    CollisionConflictResolutionPolicy collisionConflictResolutionPolicy,
    ChangeBatch sourceChanges,
    IChangeDataRetriever changeDataRetriever,
    SyncKnowledge destinationKnowledge,
    ForgottenKnowledge destinationForgottenKnowledge,
    INotifyingChangeApplierTarget changeApplierTarget,
    IConflictLogAccess conflictLogAccess,
    SyncSessionContext syncSessionState,
    SyncCallbacks syncCallback
)
public:
void ApplyChanges(
    ConflictResolutionPolicy resolutionPolicy, 
    CollisionConflictResolutionPolicy collisionConflictResolutionPolicy, 
    ChangeBatch^ sourceChanges, 
    IChangeDataRetriever^ changeDataRetriever, 
    SyncKnowledge^ destinationKnowledge, 
    ForgottenKnowledge^ destinationForgottenKnowledge, 
    INotifyingChangeApplierTarget^ changeApplierTarget, 
    IConflictLogAccess^ conflictLogAccess, 
    SyncSessionContext^ syncSessionState, 
    SyncCallbacks^ syncCallback
)
member ApplyChanges : 
        resolutionPolicy:ConflictResolutionPolicy * 
        collisionConflictResolutionPolicy:CollisionConflictResolutionPolicy * 
        sourceChanges:ChangeBatch * 
        changeDataRetriever:IChangeDataRetriever * 
        destinationKnowledge:SyncKnowledge * 
        destinationForgottenKnowledge:ForgottenKnowledge * 
        changeApplierTarget:INotifyingChangeApplierTarget * 
        conflictLogAccess:IConflictLogAccess * 
        syncSessionState:SyncSessionContext * 
        syncCallback:SyncCallbacks -> unit 
public function ApplyChanges(
    resolutionPolicy : ConflictResolutionPolicy, 
    collisionConflictResolutionPolicy : CollisionConflictResolutionPolicy, 
    sourceChanges : ChangeBatch, 
    changeDataRetriever : IChangeDataRetriever, 
    destinationKnowledge : SyncKnowledge, 
    destinationForgottenKnowledge : ForgottenKnowledge, 
    changeApplierTarget : INotifyingChangeApplierTarget, 
    conflictLogAccess : IConflictLogAccess, 
    syncSessionState : SyncSessionContext, 
    syncCallback : SyncCallbacks
)

参数

异常

异常 条件
ArgumentNullException

sourceChanges、changeDataRetriever、 destinationKnowledge、changeApplierTarget 或 syncCallback 为 null Nothing nullptr unit null 引用(在 Visual Basic 中为 Nothing) 。

ArgumentOutOfRangeException

— 或者 —

SyncIdFormatMismatchException
  • sourceChanges 具有某些遗忘知识,其格式不同于destinationKnowledge

— 或者 —

  • destinationForgottenKnowledge 已给出但其格式不同于destinationKnowledge

注释

此方法检测 sourceChanges 中发送的变更与目标副本中相应项之间发生的并发冲突。它根据 resolutionPolicy 指定的策略来解决所有并发冲突。当目标提供程序报告抵触约束冲突时,此方法将根据 collisionConflictResolutionPolicy 指定的策略解决这些冲突。如果未设置冲突解决策略,则此方法会将冲突通知应用程序,然后应用程序将指定一个冲突解决操作。如有必要,此方法随后会对 changeApplierTarget 调用方法,以将变更保存到目标副本中并保存未解决的冲突。

为了获取目标版本,此方法会针对 sourceChanges 中的每个项对 changeApplierTarget 调用 TryGetDestinationVersion

通过解决日志中的冲突并从日志中删除过时的冲突,变更应用方可帮助管理 conflictLogAccess 指定的冲突日志。变更应用方还可以使用冲突日志来存储因合并约束冲突而导致的临时冲突。在同步会话结束前,添加到日志中的任何临时冲突都将被删除。

请参阅

参考

NotifyingChangeApplier类

NotifyingChangeApplier 成员

ApplyChanges 重载

Microsoft.Synchronization 命名空间