Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Resolve method
Collapse the table of content
Expand the table of content

ICustomMapping.Resolve method

Resolves discrepancies in the values of one or more fields in a list item with respect to its current client value, its current value in the database, and its value when originally retrieved from the database.

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

void Resolve(
	RefreshMode mode,
	Object originalListItem,
	Object databaseListItem
)

Parameters

mode
Type: Microsoft.SharePoint.Linq.RefreshMode

A value that specifies the rule to use in resolving discrepancies.

originalListItem
Type: System.Object

An object that represents the values of the list item when it was originally retrieved from the content database by the client item and that can be cast to SPListItem.

databaseListItem
Type: System.Object

An object that represents the current values of the list item in the database item and that can be cast to SPListItem.

The following code shows a sample implementation of Resolve(RefreshMode, Object, Object). In this example, the Books list (whose content type is Book) has new columns named ISBN and UPCA.


public void Resolve(RefreshMode mode, object originalListObject, object databaseListObject)
{
    SPListItem originalListItem = (SPListItem)originalListObject;
    SPListItem databaseListItem = (SPListItem)databaseListObject;
           
    
    if ((mode == RefreshMode.OverwriteCurrentValues)
        ||
        ((mode == RefreshMode.KeepChanges) && (this == originalListItem)))
    
    {
        this.ISBN = databaseListItem["ISBN"];
        this.UPCA = databaseListItem["UPCA"];
    
    }
    else if (mode == RefreshMode.KeepChanges)
    {
        if (!(OriginalValues.Contains("ISBN")))
        {
            this.ISBN = databaseListItem["ISBN"];
        }
        
         if (!(OriginalValues.Contains("UPCA")))
        {
            this.UPCA = databaseListItem["UPCA"];
        }      
    }
} 

Show:
© 2015 Microsoft