ICustomMapping.MapTo Method
Assigns a property to a field (column) so that LINQ to SharePoint can save the value of the property to the field in the content database.
Namespace: Microsoft.SharePoint.Linq
Assembly: Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)
Syntax
'Declaration
Sub MapTo ( _
listItem As Object _
)
'Usage
Dim instance As ICustomMapping
Dim listItem As Object
instance.MapTo(listItem)
void MapTo(
Object listItem
)
Parameters
listItem
Type: System.ObjectAn Object that represents a list item and that can be cast to SPListItem.
Remarks
Notes to Implementers
Do not decorate this method with a CustomMappingAttribute.
Examples
The following code shows a sample implementation of MapTo(Object). In this example, the Books list (whose content type is Book) has new columns named ISBN and UPCA.
public partial class Book : ICustomMapping
{
public void MapTo(object listItem)
{
SPListItem item = (SPListItem)listItem;
item["ISBN"] = this.ISBN;
item["UPCA"] = this.UPCA;
}
// Other members omitted.
}
Partial Public Class Book
Implements ICustomMapping
Public Sub MapTo(ByVal listItem As Object)
Dim item As SPListItem = CType(listItem, SPListItem)
item("ISBN") = Me.ISBN
item("UPCA") = Me.UPCA
End Sub
' Other members omitted.
End Class
See Also
Reference
Microsoft.SharePoint.Linq Namespace