ApplyChanges 方法 (ConflictResolutionPolicy, ChangeBatch, IChangeDataRetriever, SyncKnowledge, ForgottenKnowledge, INotifyingChangeApplierTarget, SyncSessionContext, SyncCallbacks)
針對變更的批次執行衝突偵測、衝突處理和變更套用。
命名空間: Microsoft.Synchronization
組件: Microsoft.Synchronization (在 Microsoft.Synchronization.dll 中)
語法
'宣告
Public Sub ApplyChanges ( _
resolutionPolicy As ConflictResolutionPolicy, _
sourceChanges As ChangeBatch, _
changeDataRetriever As IChangeDataRetriever, _
destinationKnowledge As SyncKnowledge, _
destinationForgottenKnowledge As ForgottenKnowledge, _
changeApplierTarget As INotifyingChangeApplierTarget, _
syncSessionState As SyncSessionContext, _
syncCallback As SyncCallbacks _
)
'用途
Dim instance As NotifyingChangeApplier
Dim resolutionPolicy As ConflictResolutionPolicy
Dim sourceChanges As ChangeBatch
Dim changeDataRetriever As IChangeDataRetriever
Dim destinationKnowledge As SyncKnowledge
Dim destinationForgottenKnowledge As ForgottenKnowledge
Dim changeApplierTarget As INotifyingChangeApplierTarget
Dim syncSessionState As SyncSessionContext
Dim syncCallback As SyncCallbacks
instance.ApplyChanges(resolutionPolicy, _
sourceChanges, changeDataRetriever, _
destinationKnowledge, destinationForgottenKnowledge, _
changeApplierTarget, syncSessionState, _
syncCallback)
public void ApplyChanges(
ConflictResolutionPolicy resolutionPolicy,
ChangeBatch sourceChanges,
IChangeDataRetriever changeDataRetriever,
SyncKnowledge destinationKnowledge,
ForgottenKnowledge destinationForgottenKnowledge,
INotifyingChangeApplierTarget changeApplierTarget,
SyncSessionContext syncSessionState,
SyncCallbacks syncCallback
)
public:
void ApplyChanges(
ConflictResolutionPolicy resolutionPolicy,
ChangeBatch^ sourceChanges,
IChangeDataRetriever^ changeDataRetriever,
SyncKnowledge^ destinationKnowledge,
ForgottenKnowledge^ destinationForgottenKnowledge,
INotifyingChangeApplierTarget^ changeApplierTarget,
SyncSessionContext^ syncSessionState,
SyncCallbacks^ syncCallback
)
member ApplyChanges :
resolutionPolicy:ConflictResolutionPolicy *
sourceChanges:ChangeBatch *
changeDataRetriever:IChangeDataRetriever *
destinationKnowledge:SyncKnowledge *
destinationForgottenKnowledge:ForgottenKnowledge *
changeApplierTarget:INotifyingChangeApplierTarget *
syncSessionState:SyncSessionContext *
syncCallback:SyncCallbacks -> unit
public function ApplyChanges(
resolutionPolicy : ConflictResolutionPolicy,
sourceChanges : ChangeBatch,
changeDataRetriever : IChangeDataRetriever,
destinationKnowledge : SyncKnowledge,
destinationForgottenKnowledge : ForgottenKnowledge,
changeApplierTarget : INotifyingChangeApplierTarget,
syncSessionState : SyncSessionContext,
syncCallback : SyncCallbacks
)
參數
- resolutionPolicy
型別:Microsoft.Synchronization. . :: . .ConflictResolutionPolicy
要用來解決衝突的原則。
- sourceChanges
型別:Microsoft.Synchronization. . :: . .ChangeBatch
來源提供者的變更批次。
- changeDataRetriever
型別:Microsoft.Synchronization. . :: . .IChangeDataRetriever
可用來從來源複寫中擷取項目資料的物件。
- destinationKnowledge
型別:Microsoft.Synchronization. . :: . .SyncKnowledge
目的地複寫的知識。
- destinationForgottenKnowledge
型別:Microsoft.Synchronization. . :: . .ForgottenKnowledge
目的地複寫的被遺忘知識。
- changeApplierTarget
型別:Microsoft.Synchronization. . :: . .INotifyingChangeApplierTarget
將要針對儲存變更和衝突所呼叫的物件。
- syncSessionState
型別:Microsoft.Synchronization. . :: . .SyncSessionContext
有關目前工作階段的狀態資訊。
- syncCallback
型別:Microsoft.Synchronization. . :: . .SyncCallbacks
將會接收有關變更套用事件之通知的回呼。
例外
例外狀況 | 條件 |
---|---|
ArgumentNullException | sourceChanges、changeDataRetriever、destinationKnowledge、changeApplierTarget 或 syncCallback 是 null Nothing nullptr unit null 參考 (在 Visual Basic 中為 Nothing) 。 |
ArgumentOutOfRangeException | resolutionPolicy 不是 ConflictResolutionPolicy 列舉的成員。 |
SyncIdFormatMismatchException |
-或-
|
備註
這個方法會偵測 sourceChanges 中所傳送變更與目的地複寫中對應項目之間發生的衝突。它會根據 resolutionPolicy 所指定的原則,解決任何衝突。如果有必要,這個方法便會呼叫 changeApplierTarget 上的方法,將變更儲存至目的地複寫,並且儲存未解決的衝突。
若要取得目的地版本,這個方法會針對 sourceChanges 中每個項目的 changeApplierTarget 呼叫 TryGetDestinationVersion。