MemberChangeConflict.Resolve Method (RefreshMode)
.NET Framework (current version)
Uses a RefreshMode parameter to automatically specify the value to set as the current value for the member in conflict.
Assembly: System.Data.Linq (in System.Data.Linq.dll)
Parameters
- refreshMode
-
Type:
System.Data.Linq.RefreshMode
See RefreshMode.
The following examples show what results are produced by using the various values for RefreshMode.
The following example overwrites current values with values from the database.
Dim db As New Northwnd("...") Try db.SubmitChanges(ConflictMode.ContinueOnConflict) Catch ex As ChangeConflictException Console.WriteLine(ex.Message) For Each occ As ObjectChangeConflict In db.ChangeConflicts ' All database values overwrite current values. occ.Resolve(Data.Linq.RefreshMode.OverwriteCurrentValues) Next End Try
The following example shows how to swap the original value with the values retrieved from the database. No current value is modified.
Try db.SubmitChanges(ConflictMode.ContinueOnConflict) Catch ex As ChangeConflictException Console.WriteLine(ex.Message) For Each occ As ObjectChangeConflict In db.ChangeConflicts ' No database values are merged into current. occ.Resolve(Data.Linq.RefreshMode.KeepCurrentValues) Next End Try
The following example keeps the current values that have been changed, but updates the other values with database values.
Try db.SubmitChanges(ConflictMode.ContinueOnConflict) Catch ex As ChangeConflictException Console.WriteLine(ex.Message) For Each occ As ObjectChangeConflict In db.ChangeConflicts ' Automerge database values into current for members ' that client has not modified. occ.Resolve(Data.Linq.RefreshMode.KeepChanges) Next End Try ' Submit succeeds on second try. db.SubmitChanges(ConflictMode.FailOnFirstConflict)
.NET Framework
Available since 3.5
Windows Phone Silverlight
Available since 7.1
Available since 3.5
Windows Phone Silverlight
Available since 7.1
Show: