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 所指定之衝突記錄檔中的衝突並從記錄檔中移除過時的衝突,協助管理衝突記錄檔。變更套用者可能也會使用衝突記錄檔來儲存合併條件約束衝突所導致的暫時衝突。在同步處理工作階段結束之前,將會移除任何加入至記錄檔的暫時衝突。