Duration (Pacific Standard Time):
To (Pacific Standard Time):
Impact:
  • None
User Action:
  • None

DataContext.ChangeConflicts Property

 

Gets a collection of objects that caused concurrency conflicts when SubmitChanges was called.

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

Public ReadOnly Property ChangeConflicts As ChangeConflictCollection

Property Value

Type: System.Data.Linq.ChangeConflictCollection

A collection of objects that caused concurrency conflicts.

The following example shows how the collection can be iterated over to retrieve conflict information.

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
.NET Framework
Available since 3.5
Windows Phone Silverlight
Available since 7.1
Return to top