CustomMappingAttribute Class

Identifies what new columns are mapped with the MapFrom(Object) method that is decorated with the attribute.

Inheritance Hierarchy


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


<AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple := False)> _
Public NotInheritable Class CustomMappingAttribute _
    Inherits Attribute
Dim instance As CustomMappingAttribute
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false)]
public sealed class CustomMappingAttribute : Attribute


You can also map properties to particular hashtable entries in the SPListItem.Properties property bag.


The following example shows how CustomMappingAttribute is used on the MapFrom(Object) method.


Although the mapping applies to the MapTo(Object) method as well, only the MapFrom(Object) method is decorated with the attribute.

public partial class Book : ICustomMapping
    [CustomMapping(Columns = new String[] { "ISBN", "UPCA" })]
    public void MapFrom(object listItem)
        SPListItem item = (SPListItem)listItem;
        this.ISBN = item["ISBN"];
        this.UPCA = item["UPCA"];

    // Other members omitted.


Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also


CustomMappingAttribute Members

Microsoft.SharePoint.Linq Namespace