共用方式為


ConflictType 列舉型別

定義在同步處理期間可能發生的衝突類型。

命名空間:  Microsoft.Synchronization.Data
組件:  Microsoft.Synchronization.Data (在 Microsoft.Synchronization.Data.dll 中)

語法

'宣告
Public Enumeration ConflictType
'用途
Dim instance As ConflictType
public enum ConflictType
public enum class ConflictType
type ConflictType
public enum ConflictType

成員

成員名稱 描述
Unknown 用戶端同步處理提供者可以將它遇到的所有衝突進行分類,但是伺服器同步處理提供者則無法這樣做。因此,某些衝突會分類為 Unknown。
ErrorsOccurred 用戶端或伺服器存放區 (通常是資料庫) 在套用變更時擲回了例外狀況 (Exception)。
ClientUpdateServerUpdate 用戶端和伺服器更新了相同的資料列。
ClientUpdateServerDelete 伺服器刪除了用戶端更新的資料列。
ClientDeleteServerUpdate 用戶端刪除了伺服器更新的資料列。
ClientInsertServerInsert 用戶端和伺服器插入了具有相同主索引鍵值的資料列,這會產生主索引鍵違規。

備註

如果在同步處理之間於一個以上的位置插入、更新或刪除相同的資料列,就會發生衝突。衝突永遠都定義為在目前同步處理的伺服器與用戶端之間所發生。但是,這不表示伺服器上的衝突變更一定是源自於伺服器。如需詳細資訊,請參閱 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

請參閱

參考

Microsoft.Synchronization.Data 命名空間