MemoryConflictLog.SaveConstraintConflict 方法

保存有关导致约束冲突的变更的信息。

命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization(在 microsoft.synchronization.dll 中)

语法

声明
Public Sub SaveConstraintConflict ( _
    conflictingChange As ItemChange, _
    conflictingItemId As SyncId, _
    reason As ConstraintConflictReason, _
    conflictingChangeData As Object, _
    conflictingChangeKnowledge As SyncKnowledge, _
    temporary As Boolean _
)
用法
Dim instance As MemoryConflictLog
Dim conflictingChange As ItemChange
Dim conflictingItemId As SyncId
Dim reason As ConstraintConflictReason
Dim conflictingChangeData As Object
Dim conflictingChangeKnowledge As SyncKnowledge
Dim temporary As Boolean

instance.SaveConstraintConflict(conflictingChange, conflictingItemId, reason, conflictingChangeData, conflictingChangeKnowledge, temporary)
public void SaveConstraintConflict (
    ItemChange conflictingChange,
    SyncId conflictingItemId,
    ConstraintConflictReason reason,
    Object conflictingChangeData,
    SyncKnowledge conflictingChangeKnowledge,
    bool temporary
)
public:
virtual void SaveConstraintConflict (
    ItemChange^ conflictingChange, 
    SyncId^ conflictingItemId, 
    ConstraintConflictReason reason, 
    Object^ conflictingChangeData, 
    SyncKnowledge^ conflictingChangeKnowledge, 
    bool temporary
) sealed
public final void SaveConstraintConflict (
    ItemChange conflictingChange, 
    SyncId conflictingItemId, 
    ConstraintConflictReason reason, 
    Object conflictingChangeData, 
    SyncKnowledge conflictingChangeKnowledge, 
    boolean temporary
)
public final function SaveConstraintConflict (
    conflictingChange : ItemChange, 
    conflictingItemId : SyncId, 
    reason : ConstraintConflictReason, 
    conflictingChangeData : Object, 
    conflictingChangeKnowledge : SyncKnowledge, 
    temporary : boolean
)

参数

  • conflictingChange
    源提供程序中的冲突变更的项元数据。
  • conflictingItemId
    目标副本中与 conflictingChange 指定的项发生冲突的项的项 ID。
  • reason
    发生冲突的原因。
  • conflictingChangeData
    冲突变更的项数据。
  • conflictingChangeKnowledge
    应用此变更时要了解的知识。它必须和变更一起保存。
  • temporary
    如果这是临时冲突,则为 true。否则为 false

异常

异常类型 条件

ArgumentNullException

conflictingChange 或 conflictingChangeKnowledge 为 null 引用(在 Visual Basic 中为 Nothing)。

备注

冲突被保存在内存中的冲突日志中。若要在同步完成后保存冲突,请调用 Persist

示例

以下示例说明如何使用 MemoryConflictLog 对象保存临时约束冲突。

Public Sub SaveConstraintConflict(ByVal conflictingChange As ItemChange, ByVal conflictingItemId As SyncId, ByVal reason As ConstraintConflictReason, ByVal conflictingChangeData As Object, ByVal conflictingChangeKnowledge As SyncKnowledge, ByVal temporary As Boolean) Implements INotifyingChangeApplierTarget2.SaveConstraintConflict
    If Not temporary Then
        ' The in-memory conflict log is used, so if a non-temporary conflict is saved, it's
        ' an error.
        Throw New NotImplementedException("SaveConstraintConflict can only save temporary conflicts.")
    Else
        ' For temporary conflicts, just pass on the data and let the conflict log handle it.
        _memConflictLog.SaveConstraintConflict(conflictingChange, conflictingItemId, reason, conflictingChangeData, conflictingChangeKnowledge, temporary)
    End If
End Sub
public void SaveConstraintConflict(ItemChange conflictingChange, SyncId conflictingItemId, 
    ConstraintConflictReason reason, object conflictingChangeData, SyncKnowledge conflictingChangeKnowledge, 
    bool temporary)
{
    if (!temporary)
    {
        // The in-memory conflict log is used, so if a non-temporary conflict is saved, it's
        // an error.
        throw new NotImplementedException("SaveConstraintConflict can only save temporary conflicts.");
    }
    else
    {
        // For temporary conflicts, just pass on the data and let the conflict log handle it.
        _memConflictLog.SaveConstraintConflict(conflictingChange, conflictingItemId, reason, 
            conflictingChangeData, conflictingChangeKnowledge, temporary);
    }
}

请参阅

参考

MemoryConflictLog 类
MemoryConflictLog 成员
Microsoft.Synchronization 命名空间