Microsoft.SharePoint.Linq namespace

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

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.

Specifies 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.