Partilhar via


MemberChangeConflict.Resolve Method (Object)

Resolves the discrepancy by setting client value (that is, the value in the current process on the front-end Web server) of the field (or property) to the specified object.

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

Syntax

'Declaration
Public Sub Resolve ( _
    value As Object _
)
'Usage
Dim instance As MemberChangeConflict
Dim value As Object

instance.Resolve(value)
public void Resolve(
    Object value
)

Parameters

  • value
    Type: System.Object

    The value to which the field (or property) should be set.

Remarks

Typically, if you want the client value to be either CurrentValue, OriginalValue, or DatabaseValue, you call the other overload of Resolve(RefreshMode) and pass it an appropriate RefreshMode value. This overload is useful for setting the client value to some fourth object.

The change made by this method is not persisted to the database until SubmitChanges is called again.

Examples

The following code shows how Resolve(Object) can be used to assign a value to a field that indicates it is disputed. This assignment is only made if the MemberChangeConflict object represents an actual concurrency conflict; that is, another user has changed the field since this client process last retrieved it from the content database.

catch (ChangeConflictException e) 
{
    foreach (ObjectChangeConflict changedListItem in teamSite.ChangeConflicts)
    {
        foreach (MemberChangeConflict changedField in changedListItem.MemberConflicts)
        {
            if (changedField.Member.OriginalValue != changedField.Member.OriginalValue)
            {
                changedField.Resolve(((Object)”Disputed”));
            }
            else
            {
               changedField.Resolve(RefreshMode.KeepCurrentValues);
            }
        }
    }
}

    // Remainder of catch block omitted.
} 
Catch e As ChangeConflictException
    For Each changedListItem As ObjectChangeConflict In teamSite.ChangeConflicts
        For Each changedField As MemberChangeConflict In changedListItem.MemberConflicts
            If changedField.Member.OriginalValue IsNot changedField.Member.OriginalValue Then
                changedField.Resolve((CType("Disputed", Object)))
            Else
               changedField.Resolve(RefreshMode.KeepCurrentValues)
            End If
        Next changedField
    Next changedListItem
End Try

    ' Remainder of catch block omitted.

See Also

Reference

MemberChangeConflict Class

MemberChangeConflict Members

Resolve Overload

Microsoft.SharePoint.Linq Namespace