This topic has not yet been rated - Rate this topic

Microsoft.SharePoint.Linq namespace

Provides the classes that implement the LINQ to SharePoint provider.

The main gateway class that provides access to the Microsoft SharePoint Foundation is DataContext which provides for LINQ querying, writing to the content databases, and object change management. Its two most important method are GetList<T>(String), which returns the queryable EntityList<TEntity> object that represents a list, and SubmitChanges(), which writes changes to the content database.

The namespace also provides a set of “entity classes” that represent list items and field values and which, together with EntityList<TEntity> provide an object-relational mapping and interface between your object-oriented .Net code and the relational structure of the content databases. The other principal entity classes are EntityRef<TEntity>, EntitySet<TEntity>, and LookupList<T>. The first two of these implement deferred loading; so the constructor of an EntityList<TEntity> does not have to load entity objects from its entity associations. Each field in a list item is loaded only when it is first referenced in post-constructor code.

To facilitate the object-relational mapping, a rich set of attribute classes are provided. The most important of these are ContentTypeAttribute, which decorates a class that represents the content type of a list, ColumnAttribute, which decorates a property that represents a column (field) in a list, and AssociationAttribute, which decorates properties which represent a lookup relationship between a column in one list and a column in another.

LINQ to SharePoint enables writing to the content databases using optimistic concurrency. This requires a system for tracking changes to objects, detecting concurrency conflicts, and resolving those conflicts. Several classes are provided to support this system including ITrackEntityState, ObjectChangeConflict, and MemberChangeConflict.

Finally, the ICustomMapping interface provides a means of extending an already deployed SharePoint Foundation solution to handle columns added to a list after the initial deployment without requiring recompilation of the original solution assemblies or even redeployment of them.

Note Note

The namespace also contains two public classes needed to enable querying SharePoint Foundation lists with ADO.NET Data Services. These are not documented because they should not be called from your code.

  ClassDescription
Public classAssociationAttributeSpecifies that the property (mapped to a list field) has an association to another list, such as when the property is mapped to a lookup field.
Public classAssociationChangedEventArgs<T>Provides data for the OnChanged event of EntityRef<TEntity>, EntitySet<TEntity>, or Microsoft.SharePoint.Linq.LookupList<T>.
Public classChangeConflictCollectionRepresents a collection of ObjectChangeConflict objects.
Public classChangeConflictExceptionRepresents the exception that is thrown when an update fails because database values have been updated since the client last read them.
Public classChoiceAttributeMaps a member of an enumeration to a String choice value for a Choice or MultiChoice type field on a Microsoft SharePoint Foundation list.
Public classColumnAttributeSpecifies that the property is mapped to a field (column) in a Microsoft SharePoint Foundation list.
Public classContentTypeAttributeSpecifies that the class maps to a Microsoft SharePoint Foundation content type.
Public classCustomMappingAttributeIdentifies what new columns are mapped with the MapFrom(Object) method that is decorated with the attribute.
Public classDataAttributeProvides two optional properties commonly used by attributes on properties (of entity classes) that are mapped to list fields (columns) or list properties.
Public classDataContextProvides LINQ (Language Integrated Query) access to, and change tracking for, the lists and document libraries of a Microsoft SharePoint Foundation Web site.
Public classDerivedEntityClassAttributeIdentifies a class that derives from the class to which the attribute is applied.
Public classEntityList<TEntity>Represents a Microsoft SharePoint Foundation list that can be queried with Language Integrated Query (LINQ).
Public classEntityRef<TEntity>Provides for deferred loading and relationship maintenance for the singleton side of a one-to-many relationship.
Public classEntitySet<TEntity>Provides for deferred loading and relationship maintenance for the “many” side of one-to-many and many-to-many relationships
Public classListAttributeSpecifies that a property of a DataContext object represents a Microsoft SharePoint Foundation list.
Public classLookupList<T>Represents the values of a Microsoft SharePoint Foundation lookup field (column) that allows multiple values.
Public classMemberChangeConflictSpecifies information about a discrepancy between the value of a field (or list item metadata property) in the database and its value in the current process on the front-end Web server - its client value.
Public classObjectChangeConflictSpecifies information about discrepancies between the current client value of one or more fields in a list item and the current database values of the fields.
Public classRemovedColumnAttributeSpecifies that the property maps to a field (column) that is on the parent content type but was removed from the derived content type.
Public classResourceStringsThis type or member supports Microsoft Windows SharePoint Services and is not intended to be used directly from your code.
Public classUtilityProvides miscellaneous functionality to the LINQ to SharePoint provider.
  InterfaceDescription
Public interfaceICustomMappingEnables extension of the object-relational mapping system of the LINQ to SharePoint provider.
Public interfaceITrackEntityStateEnables participation in the object tracking system of the LINQ to SharePoint provider.
Public interfaceITrackOriginalValuesEnables implementing classes to store a dictionary of changed properties and their original values.
  EnumerationDescription
Public enumerationAssociationChangedStateSpecifies how an EntityRef<TEntity>, EntitySet<TEntity>, or Microsoft.SharePoint.Linq.LookupList<T> changes.
Public enumerationAssociationTypeSpecifies the type of lookup relation between a field (column) in one list and a field in another list.
Public enumerationConflictModeSpecifies when an attempt to submit changes to a list should be stopped and a ChangeConflictException thrown.
Public enumerationEntityStateRecords the changed state of an entity (usually a list item; but possibly a detached entity).
Public enumerationRefreshModeSpecifies 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.
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.