EntitySet<TEntity> Class

Provides for deferred loading and relationship maintenance for the “many” side of one-to-many and many-to-many relationships


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

public sealed class EntitySet<TEntity> : IList<TEntity>, 
	ICollection<TEntity>, IOrderedQueryable<TEntity>, IQueryable<TEntity>, 
	IEnumerable<TEntity>, IOrderedQueryable, IQueryable, IList, ICollection, 
	IEnumerable, ICloneable
where TEntity : class

Type Parameters


The type of the member of the collection.

For example, suppose a Team Members list has an Assigned Projects column that is a lookup field to a Projects list. More than one team member can be assigned to a particular project and a particular team member can be assigned to more than one project; so this is a many-to-many relationship.

The following code shows how the AssignedProjects property in the scenario described above would be declared as an EntitySet<TEntity> type that wraps a private EntitySet<TEntity> field:

[ContentType(Name="Item", Id="0x01", List="Team Members")]

public partial class TeamMembersItem : Item {
    private EntitySet<Project> _projects;

    public TeamMembersItem() {
        this._manager = new EntitySet<Project>();

    [Association(Name="AssignedProjects", Storage="_projects ", MultivalueType=AssociationType.Multi, List="Projects")]
    public EntitySet<Project> AssignedProjects {
        get {
            return this._projects;
        set {

    // Other members omitted for readability.

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