Partilhar via


Método MemoryConflictLog.SaveConstraintConflict

Salva informações sobre uma alteração que causou um conflito de restrição.

Namespace: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (em microsoft.synchronization.dll)

Sintaxe

'Declaração
Public Sub SaveConstraintConflict ( _
    conflictingChange As ItemChange, _
    conflictingItemId As SyncId, _
    reason As ConstraintConflictReason, _
    conflictingChangeData As Object, _
    conflictingChangeKnowledge As SyncKnowledge, _
    temporary As Boolean _
)
'Uso
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
)

Parâmetros

  • conflictingChange
    Os metadados de item para a alteração conflitante do provedor de origem.
  • conflictingItemId
    A ID do item na réplica de destino que está em conflito com o item especificado por conflictingChange.
  • reason
    O motivo pelo qual o conflito ocorreu.
  • conflictingChangeData
    Os dados de item para a alteração conflitante.
  • conflictingChangeKnowledge
    O conhecimento a ser aprendido se esta alteração for aplicada. Esse conhecimento deve ser salvo com a alteração.
  • temporary
    true se esse for um conflito temporário. Caso contrário, false.

Exceções

Tipo de exceção Condição

ArgumentNullException

conflictingChange ou conflictingChangeKnowledge é um referência nula (Nothing no Visual Basic).

Comentários

O conflito é salvo no log de conflitos na memória. Para salvar o conflito depois que sincronização for concluída, chame Persist.

Exemplo

O exemplo a seguir mostra como salvar um conflito de restrição temporário usando um objeto 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);
    }
}

Consulte também

Referência

Classe MemoryConflictLog
Membros MemoryConflictLog
Namespace Microsoft.Synchronization