Share via


Microsoft.SharePoint.Linq 命名空间

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.

备注

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.

  说明
公共类 AssociationAttribute 指定 (映射到列表字段) 的属性具有一个关联到另一个列表,例如,当将该属性映射到查找字段。
公共类 AssociationChangedEventArgs<T> EntityRef<TEntity>EntitySet<TEntity>Microsoft.SharePoint.Linq.LookupList<T>OnChanged事件提供数据。
公共类 ChangeConflictCollection 表示ObjectChangeConflict对象的集合。
公共类 ChangeConflictException 表示当由于客户端上次读取数据库值已更新导致更新失败时引发的异常。
公共类 ChoiceAttribute 将枚举成员映射到StringMicrosoft SharePoint Foundation列表上选择或 MultiChoice 类型字段选择值。
公共类 ColumnAttribute 指定的属性将映射到的字段 (列) Microsoft SharePoint Foundation列表中。
公共类 ContentTypeAttribute 指定类映射到Microsoft SharePoint Foundation内容类型。
公共类 CustomMappingAttribute 标识哪些新的列映射用特性修饰的MapFrom(Object)方法。
公共类 DataAttribute 提供了常用的 (实体类) 的属性映射到列表中的字段 (列) 或列表属性上的特性的两个可选属性。
公共类 DataContext 提供 LINQ (语言集成查询) 访问和更改跟踪、 列表和Microsoft SharePoint Foundation网站的文档库。
公共类 DerivedEntityClassAttribute 标识该属性所应用于的类从派生的类。
公共类 EntityList<TEntity> 表示一个Microsoft SharePoint Foundation列表,可使用语言集成查询 (LINQ) 查询。
公共类 EntityRef<TEntity> 提供一个一对多关系的单一方的延迟加载和关系维护。
公共类 EntitySet<TEntity> 提供的一对多和多对多关系的"多"端的延迟加载和关系维护
公共类 ListAttribute 指定的DataContext对象属性表示Microsoft SharePoint Foundation列表。
公共类 LookupList<T> 表示允许多个值的Microsoft SharePoint Foundation查阅字段 (列) 的值。
公共类 MemberChangeConflict 指定数据库和前端的 Web 服务器-客户端值上的当前进程中其值的字段 (或多个列表项的元数据属性) 的值之间的差异的信息。
公共类 ObjectChangeConflict 指定信息在列表项中的一个或多个字段的当前客户端值与当前数据库的字段的值之间的差别。
公共类 RemovedColumnAttribute 指定该属性映射到的字段 (列) 的父内容类型,但已从派生的内容类型中删除。
公共类 ResourceStrings 此类型或成员支持 Microsoft Windows SharePoint Services,并且不应从代码直接使用。
公共类 Utility 提供到 SharePoint 提供的其他功能。

接口

  接口 说明
公共接口 ICustomMapping 启用 LINQ to SharePoint 提供程序的对象关系映射系统的扩展。
公共接口 ITrackEntityState 使对象跟踪 SharePoint 提供的 LINQ 的系统中的参与。
公共接口 ITrackOriginalValues 用于实现类来存储已更改的属性和它们的原始值的字典。

枚举

  枚举 说明
公共枚举 AssociationChangedState 指定如何更改EntityRef<TEntity>EntitySet<TEntity>Microsoft.SharePoint.Linq.LookupList<T>
公共枚举 AssociationType 指定在另一个列表中的查阅字段和一个列表中的字段 (列) 之间的关系的类型。
公共枚举 ConflictMode 指定应何时停止尝试将更改提交到列表并引发ChangeConflictException
公共枚举 EntityState 记录已更改的实体 (通常一个列表项) ; 但可能是分离的实体) 的状态。
公共枚举 RefreshMode 指定时发现列表项已被另一个进程因为它已检索更改列表项更改系统的 LINQ to SharePoint 提供程序将如何响应。