Export (0) Print
Expand All

RefreshMode enumeration

Specifies how the list item changing system of the LINQ to SharePoint provider will respond when it finds that a list item has been changed by another process since it was retrieved.

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

public enum RefreshMode

Member nameDescription
KeepChangesMerging with Database Values (that is, accept every user’s changes with prejudice for the current user). This means:
When applied to a MemberChangeConflict object: Keep the current client value if it has changed since originally retrieved; otherwise make it match the current database value.
When applied to an ObjectChangeConflict object: Keep the new values for fields that the current version has changed since the original retrieval, even if they conflict with the latest version in the database; but all other fields should be changed as needed to match the latest version in the database.
KeepCurrentValuesOverwriting Database Values (that is, overwrite all other users’ changes). This means:
When applied to a MemberChangeConflict object: Keep the current client value. (So, if it has changed since originally retrieved keep the new value; otherwise leave it at the original value.)
When applied to an ObjectChangeConflict object: Keep the new values for fields that the current version has changed since the original retrieval, even if they conflict with the latest version in the database; but all other fields should remain as they were when originally retrieved, even if those values no longer match the latest version in the database.
OverwriteCurrentValuesRetaining Database Values (that is, give absolute prejudice to the database version). This means:
When applied to a MemberChangeConflict object: Match the current database value.
When applied to an ObjectChangeConflict object: Make all values match the latest version in the database.

A value of this enumeration is passed as a parameter to the ObjectChangeConflict.Resolve(RefreshMode) or MemberChangeConflict.Resolve(RefreshMode) methods. These methods are usually called in a catch block that catches a ChangeConflictException. The exception will be thrown by the SubmitChanges() method if it finds that the list item being changed has already been changed since it was originally returned by a LINQ query.

The enumeration tells the ObjectChangeConflict.Resolve(RefreshMode) and MemberChangeConflict.Resolve(RefreshMode) methods how to respond to differences between three versions of the list item:

  • The version originally retrieved from the content database.

  • The version now in the database.

  • The version in the current process (sometimes called the client version, although “client” here refers to the front-end Web server) that was submitted by the call to SubmitChanges().

NoteNote

There is no option for cancelling all changes, even those of the current user; but you can accomplish this by calling Resolve(Object) and passing it OriginalValue as the parameter. To apply this rule to an ObjectChangeConflict, iterate over its MemberConflicts property calling Resolve(Object) for each member.

The following table lists topics that are about the System.Data.Linq.RefreshMode enumeration of LINQ to SQL provider. However, the logic they describe applies to the Microsoft.SharePoint.Linq.RefreshMode enumeration of LINQ to SharePoint equally well.

How to: Resolve Concurrency Conflicts by Merging with Database Values (LINQ to SQL)

How to: Resolve Concurrency Conflicts by Retaining Database Values (LINQ to SQL)

How to: Resolve Concurrency Conflicts by Overwriting Database Values (LINQ to SQL)

Show:
© 2014 Microsoft