ApplyChanges 方法 (ConflictResolutionPolicy, CollisionConflictResolutionPolicy, ChangeBatch, IChangeDataRetriever, IEnumerable(ItemChange), 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, _
destinationVersions As IEnumerable(Of ItemChange), _
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 destinationVersions As IEnumerable(Of ItemChange)
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, _
destinationVersions, destinationKnowledge, _
destinationForgottenKnowledge, _
changeApplierTarget, conflictLogAccess, _
syncSessionState, syncCallback)
public void ApplyChanges(
ConflictResolutionPolicy resolutionPolicy,
CollisionConflictResolutionPolicy collisionConflictResolutionPolicy,
ChangeBatch sourceChanges,
IChangeDataRetriever changeDataRetriever,
IEnumerable<ItemChange> destinationVersions,
SyncKnowledge destinationKnowledge,
ForgottenKnowledge destinationForgottenKnowledge,
INotifyingChangeApplierTarget changeApplierTarget,
IConflictLogAccess conflictLogAccess,
SyncSessionContext syncSessionState,
SyncCallbacks syncCallback
)
public:
void ApplyChanges(
ConflictResolutionPolicy resolutionPolicy,
CollisionConflictResolutionPolicy collisionConflictResolutionPolicy,
ChangeBatch^ sourceChanges,
IChangeDataRetriever^ changeDataRetriever,
IEnumerable<ItemChange^>^ destinationVersions,
SyncKnowledge^ destinationKnowledge,
ForgottenKnowledge^ destinationForgottenKnowledge,
INotifyingChangeApplierTarget^ changeApplierTarget,
IConflictLogAccess^ conflictLogAccess,
SyncSessionContext^ syncSessionState,
SyncCallbacks^ syncCallback
)
member ApplyChanges :
resolutionPolicy:ConflictResolutionPolicy *
collisionConflictResolutionPolicy:CollisionConflictResolutionPolicy *
sourceChanges:ChangeBatch *
changeDataRetriever:IChangeDataRetriever *
destinationVersions:IEnumerable<ItemChange> *
destinationKnowledge:SyncKnowledge *
destinationForgottenKnowledge:ForgottenKnowledge *
changeApplierTarget:INotifyingChangeApplierTarget *
conflictLogAccess:IConflictLogAccess *
syncSessionState:SyncSessionContext *
syncCallback:SyncCallbacks -> unit
public function ApplyChanges(
resolutionPolicy : ConflictResolutionPolicy,
collisionConflictResolutionPolicy : CollisionConflictResolutionPolicy,
sourceChanges : ChangeBatch,
changeDataRetriever : IChangeDataRetriever,
destinationVersions : IEnumerable<ItemChange>,
destinationKnowledge : SyncKnowledge,
destinationForgottenKnowledge : ForgottenKnowledge,
changeApplierTarget : INotifyingChangeApplierTarget,
conflictLogAccess : IConflictLogAccess,
syncSessionState : SyncSessionContext,
syncCallback : SyncCallbacks
)
参数
- resolutionPolicy
类型:Microsoft.Synchronization. . :: . .ConflictResolutionPolicy
用于解决冲突的策略。
- collisionConflictResolutionPolicy
类型:Microsoft.Synchronization. . :: . .CollisionConflictResolutionPolicy
用于解决抵触约束冲突的策略。
- sourceChanges
类型:Microsoft.Synchronization. . :: . .ChangeBatch
来自源提供程序的变更批。
- changeDataRetriever
类型:Microsoft.Synchronization. . :: . .IChangeDataRetriever
可用于从源副本中检索项数据的对象。
- destinationVersions
类型:System.Collections.Generic. . :: . .IEnumerable< (Of < ( <'ItemChange> ) > ) >
一个包含存储在目标副本中的项的版本的变更批。这些项与 sourceChanges 中的项相对应。
- destinationKnowledge
类型:Microsoft.Synchronization. . :: . .SyncKnowledge
目标副本的知识。
- destinationForgottenKnowledge
类型:Microsoft.Synchronization. . :: . .ForgottenKnowledge
目标副本的遗忘知识。
- changeApplierTarget
类型:Microsoft.Synchronization. . :: . .INotifyingChangeApplierTarget
将被调用以用于保存变更和冲突的对象。
- conflictLogAccess
类型:Microsoft.Synchronization. . :: . .IConflictLogAccess
在其中存储延迟冲突和临时冲突的冲突日志。
- syncSessionState
类型:Microsoft.Synchronization. . :: . .SyncSessionContext
有关当前会话的状态信息。
- syncCallback
类型:Microsoft.Synchronization. . :: . .SyncCallbacks
将接收有关变更应用事件的通知的回调。
异常
异常 | 条件 |
---|---|
ArgumentNullException | sourceChanges、changeDataRetriever、 destinationKnowledge、changeApplierTarget 或 syncCallback 为 null Nothing nullptr unit null 引用(在 Visual Basic 中为 Nothing) 。 |
ArgumentOutOfRangeException |
— 或者 — collisionResolutionPolicy 不是 CollisionConflictResolutionPolicy 枚举的成员。 |
SyncIdFormatMismatchException |
— 或者 —
|
注释
此方法检测 sourceChanges 中发送的变更与目标副本中相应项之间发生的并发冲突。它根据 resolutionPolicy 指定的策略来解决所有并发冲突。当目标提供程序报告抵触约束冲突时,此方法将根据 collisionConflictResolutionPolicy 指定的策略解决这些冲突。如果未设置冲突解决策略,则此方法会将冲突通知应用程序,然后应用程序将指定一个冲突解决操作。如有必要,此方法随后会对 changeApplierTarget 调用方法,以将变更保存到目标副本中并保存未解决的冲突。
通过解决日志中的冲突并从日志中删除过时的冲突,变更应用方可帮助管理 conflictLogAccess 指定的冲突日志。变更应用方还可以使用冲突日志来存储因合并约束冲突而导致的临时冲突。在同步会话结束前,添加到日志中的任何临时冲突都将被删除。