ObjectChangeConflict Class

 

Represents an update attempt with one or more optimistic concurrency conflicts.

Namespace:   System.Data.Linq
Assembly:  System.Data.Linq (in System.Data.Linq.dll)

System.Object
  System.Data.Linq.ObjectChangeConflict

public sealed class ObjectChangeConflict

NameDescription
System_CAPS_pubpropertyIsDeleted

Gets a value that indicates whether the object in conflict has been deleted from the database.

System_CAPS_pubpropertyIsResolved

Gets a value that indicates whether the conflicts for this object have already been resolved.

System_CAPS_pubpropertyMemberConflicts

Gets a collection of all member conflicts that caused the update to fail.

System_CAPS_pubpropertyObject

Gets the object in conflict.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodResolve()

Resolves member conflicts by keeping current values and resetting the baseline original values to match the more recent database values.

System_CAPS_pubmethodResolve(RefreshMode)

Resolves member conflicts by using the specified RefreshMode.

System_CAPS_pubmethodResolve(RefreshMode, Boolean)

Resolve member conflicts keeping current values and resetting the baseline original values.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

This scenario is one in which an attempted update fails because database values have been updated since the client last read them.

The following example shows how to retrieve information about objects in conflict.

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();
    }
}

.NET Framework
Available since 3.5
Windows Phone Silverlight
Available since 7.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: