Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
EntitySet(TEntity) Class

EntitySet<TEntity> Class

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

System.Object
  Microsoft.SharePoint.Linq.EntitySet<TEntity>

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

[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

Type Parameters

TEntity

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")]
[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.
}

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