ObjectChangeConflict ObjectChangeConflict ObjectChangeConflict ObjectChangeConflict Class

Definição

Representa uma tentativa de atualização com um ou mais conflitos de simultaneidade otimista.Represents an update attempt with one or more optimistic concurrency conflicts.

public ref class ObjectChangeConflict sealed
public sealed class ObjectChangeConflict
type ObjectChangeConflict = class
Public NotInheritable Class ObjectChangeConflict
Herança
ObjectChangeConflictObjectChangeConflictObjectChangeConflictObjectChangeConflict

Exemplos

Northwnd db = new Northwnd("...");

try
{
    db.SubmitChanges(ConflictMode.ContinueOnConflict);
}

catch (ChangeConflictException e)
{
    Console.WriteLine("Optimistic concurrency error.");
    Console.WriteLine(e.Message);
    foreach (ObjectChangeConflict occ in db.ChangeConflicts)
    {
        MetaTable metatable = db.Mapping.GetTable(occ.Object.GetType());
        Customer entityInConflict = (Customer)occ.Object;
        Console.WriteLine("Table name: {0}", metatable.TableName);
        Console.Write("Customer ID: ");
        Console.WriteLine(entityInConflict.CustomerID);
        Console.ReadLine();
    }
}
Dim db As New Northwnd("...")

Try
    db.SubmitChanges(ConflictMode.ContinueOnConflict)

Catch ex As ChangeConflictException
    Console.WriteLine("Optimistic concurrency error.")
    Console.WriteLine(ex.Message)
    For Each occ As ObjectChangeConflict In db.ChangeConflicts
        Dim metatable As MetaTable = db.Mapping.GetTable(occ.Object.GetType())
        Dim entityInConflict = occ.Object

        Console.WriteLine("Table name: " & metatable.TableName)
        Console.Write("Customer ID: ")
        Console.WriteLine(entityInConflict.CustomerID)
        Console.ReadLine()
    Next
End Try

Comentários

Esse cenário é aquele em que uma tentativa de atualização falha porque os valores do banco de dados foram atualizados desde a última leitura do cliente.This scenario is one in which an attempted update fails because database values have been updated since the client last read them.

O exemplo a seguir mostra como recuperar informações sobre objetos em conflito.The following example shows how to retrieve information about objects in conflict.

Propriedades

IsDeleted IsDeleted IsDeleted IsDeleted

Obtém um valor que indica se o objeto em conflito foi excluído do banco de dados.Gets a value that indicates whether the object in conflict has been deleted from the database.

IsResolved IsResolved IsResolved IsResolved

Obtém um valor que indica se os conflitos para este objeto já foram resolvidos.Gets a value that indicates whether the conflicts for this object have already been resolved.

MemberConflicts MemberConflicts MemberConflicts MemberConflicts

Obtém uma coleção de todos os conflitos de membro que causaram a falha de atualização.Gets a collection of all member conflicts that caused the update to fail.

Object Object Object Object

Obtém o objeto em conflito.Gets the object in conflict.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Inherited from Object)
Resolve() Resolve() Resolve() Resolve()

Resolve conflitos de membro mantendo os valores atuais e redefinindo os valores originais da linha de base para que correspondam aos valores mais recentes do banco de dados.Resolves member conflicts by keeping current values and resetting the baseline original values to match the more recent database values.

Resolve(RefreshMode) Resolve(RefreshMode) Resolve(RefreshMode) Resolve(RefreshMode)

Resolve conflitos de membro usando o RefreshMode especificado.Resolves member conflicts by using the specified RefreshMode.

Resolve(RefreshMode, Boolean) Resolve(RefreshMode, Boolean) Resolve(RefreshMode, Boolean) Resolve(RefreshMode, Boolean)

Resolve conflitos de membro mantendo os valores atuais e redefinindo os valores originais de linha de base.Resolve member conflicts keeping current values and resetting the baseline original values.

ToString() ToString() ToString() ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object.

(Inherited from Object)

Aplica-se a