ApplyChangeFailedEventArgs.Action 屬性
取得或設定 ApplyAction 列舉值,這個值會指定用來處理衝突的動作。
命名空間: Microsoft.Synchronization.Data
組件: Microsoft.Synchronization.Data (在 microsoft.synchronization.data.dll)
語法
'宣告
Public Property Action As ApplyAction
'用途
Dim instance As ApplyChangeFailedEventArgs
Dim value As ApplyAction
value = instance.Action
instance.Action = value
public ApplyAction Action { get; set; }
public:
property ApplyAction Action {
ApplyAction get ();
void set (ApplyAction value);
}
/** @property */
public ApplyAction get_Action ()
/** @property */
public void set_Action (ApplyAction value)
public function get Action () : ApplyAction
public function set Action (value : ApplyAction)
屬性值
指定用來處理衝突之動作的 ApplyAction 列舉值。
備註
如果在同步處理期間無法套用某個資料列,就會引發 ApplyChangeFailed 事件。ApplyChangeFailedEventArgs 物件會提供有關造成失敗之錯誤或衝突的資訊。在此事件的處理常式中,您可以指定同步處理提供者是否應該再次嘗試套用此資料列。用戶端上的強制寫入變更是由用戶端同步處理提供者所處理。伺服器上的強制寫入變更需要在程式碼中具有可將變更套用至伺服器的邏輯。如需詳細資訊,請參閱 HOW TO:處理資料衝突和錯誤。
範例
下列程式碼範例會針對用戶端更新/伺服器刪除衝突指定 RetryWithForceWrite
的值。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:處理資料衝突和錯誤。
if (e.Conflict.ConflictType == ConflictType.ClientUpdateServerDelete)
{
//For client-update/server-delete conflicts, we force the client
//change to be applied at the server. The stored procedure specified for
//customerSyncAdapter.UpdateCommand accepts the @sync_force_write parameter
//and includes logic to handle this case.
Console.WriteLine(String.Empty);
Console.WriteLine("***********************************");
Console.WriteLine("A client update / server delete conflict was detected.");
e.Action = ApplyAction.RetryWithForceWrite;
Console.WriteLine("The client change was retried at the server with RetryWithForceWrite.");
Console.WriteLine("***********************************");
Console.WriteLine(String.Empty);
}
If e.Conflict.ConflictType = ConflictType.ClientUpdateServerDelete Then
'For client-update/server-delete conflicts, we force the client
'change to be applied at the server. The stored procedure specified for
'customerSyncAdapter.UpdateCommand accepts the @sync_force_write parameter
'and includes logic to handle this case.
Console.WriteLine(String.Empty)
Console.WriteLine("***********************************")
Console.WriteLine("A client update / server delete conflict was detected.")
e.Action = ApplyAction.RetryWithForceWrite
Console.WriteLine("The client change was retried at the server with RetryWithForceWrite.")
Console.WriteLine("***********************************")
Console.WriteLine(String.Empty)
End If
請參閱
參考
ApplyChangeFailedEventArgs 類別
ApplyChangeFailedEventArgs 成員
Microsoft.Synchronization.Data 命名空間