EntitySet<TEntity> Class

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

Inheritance Hierarchy

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

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

Syntax

'Declaration
<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
'Usage
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

Type Parameters

  • TEntity
    The type of the member of the collection.

Remarks

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.

Examples

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

Thread Safety

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

See Also

Reference

EntitySet<TEntity> Members

Microsoft.SharePoint.Linq Namespace