EntitySet<TEntity> 类
提供的一对多和多对多关系的"多"端的延迟加载和关系维护
继承层次结构
System.Object
Microsoft.SharePoint.Linq.EntitySet<TEntity>
命名空间: Microsoft.SharePoint.Linq
程序集: Microsoft.SharePoint.Linq(位于 Microsoft.SharePoint.Linq.dll 中)
语法
声明
<DataContractAttribute> _
Public NotInheritable Class EntitySet(Of TEntity As Class) _
Implements IList(Of TEntity), ICollection(Of TEntity), _
IOrderedQueryable(Of TEntity), IQueryable(Of TEntity), IEnumerable(Of TEntity), _
IOrderedQueryable, IQueryable, IList, ICollection, IEnumerable, _
ICloneable
用法
Dim instance As EntitySet(Of TEntity)
[DataContractAttribute]
public sealed class EntitySet<TEntity> : IList<TEntity>,
ICollection<TEntity>, IOrderedQueryable<TEntity>, IQueryable<TEntity>,
IEnumerable<TEntity>, IOrderedQueryable, IQueryable, IList, ICollection,
IEnumerable, ICloneable
where TEntity : class
类型参数
- TEntity
集合中的成员的类型。
备注
例如,假设团队成员列表是项目列表的查阅字段指派项目列。可以将多个团队成员分配给特定项目和特定的团队成员可以分配给多个项目 ;因此,这是多对多关系。
示例
下面的代码演示如何在上面所述的情况下的AssignedProjects属性将被声明为EntitySet<TEntity>种包装专用EntitySet<TEntity>字段:
[ContentType(Name="Item", Id="0x01", List="Team Members")]
[DataContract()]
public partial class TeamMembersItem : Item {
[DataMember()]
private EntitySet<Project> _projects;
public TeamMembersItem() {
this._manager = new EntitySet<Project>();
this.Initialize();
}
[Association(Name="AssignedProjects", Storage="_projects ", MultivalueType=AssociationType.Multi, List="Projects")]
public EntitySet<Project> AssignedProjects {
get {
return this._projects;
}
set {
this._projects.Assign(value);
}
}
// Other members omitted for readability.
}
线程安全性
该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。