EntitySet<TEntity> Class

Definition

Provides for deferred loading and relationship maintenance for the collection side of one-to-many and one-to-one relationships in a LINQ to SQL applications.

generic <typename TEntity>
 where TEntity : classpublic ref class EntitySet sealed : System::Collections::Generic::ICollection<TEntity>, System::Collections::Generic::IEnumerable<TEntity>, System::Collections::Generic::IList<TEntity>, System::Collections::IList, System::ComponentModel::IListSource
public sealed class EntitySet<TEntity> : System.Collections.Generic.ICollection<TEntity>, System.Collections.Generic.IEnumerable<TEntity>, System.Collections.Generic.IList<TEntity>, System.Collections.IList, System.ComponentModel.IListSource where TEntity : class
type EntitySet<'Entity (requires 'Entity : null)> = class
    interface ICollection
    interface ICollection<'Entity (requires 'Entity : null)>
    interface IEnumerable
    interface seq<'Entity (requires 'Entity : null)>
    interface IList
    interface IList<'Entity (requires 'Entity : null)>
    interface IListSource
Public NotInheritable Class EntitySet(Of TEntity)
Implements ICollection(Of TEntity), IEnumerable(Of TEntity), IList, IList(Of TEntity), IListSource

Type Parameters

TEntity

The data type of the target entity.

Inheritance
EntitySet<TEntity>
Implements

Remarks

This class is used in combination with EntityRef<TEntity>.

Constructors

EntitySet<TEntity>()

Initializes a new instance of the EntitySet<TEntity> class.

EntitySet<TEntity>(Action<TEntity>, Action<TEntity>)

Initializes a new instance of the EntitySet<TEntity> class while supplying handlers for add and remove operations.

Properties

Count

Gets the number of entities in the EntitySet<TEntity> collection.

HasAssignedValues
HasLoadedOrAssignedValues

Specifies whether the EntitySet<TEntity> has loaded or assigned a value.

HasLoadedValues
IsDeferred

Specifies whether this EntitySet<TEntity> has a deferred query that has not yet executed.

Item[Int32]

Gets or sets the element at the specified index.

Methods

Add(TEntity)

Adds an entity.

AddRange(IEnumerable<TEntity>)

Adds a collection of entities.

Assign(IEnumerable<TEntity>)

Assigns an EntitySet<TEntity> collection to another EntitySet<TEntity> collection.

Clear()

Removes all items.

Contains(TEntity)

Specifies whether the EntitySet<TEntity> contains a specific entity.

CopyTo(TEntity[], Int32)

Copies the EntitySet<TEntity> to an array.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an enumerator that iterates through a collection.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNewBindingList()

Creates a new list for binding to a data source.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(TEntity)

Returns the index of the entity.

Insert(Int32, TEntity)

Inserts an entity at an index position.

Load()

Loads the EntitySet<TEntity>.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(TEntity)

Removes an entity.

RemoveAt(Int32)

Removes an entity at a specified index.

SetSource(IEnumerable<TEntity>)

Sets the source of the EntitySet<TEntity>.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

ListChanged

Occurs when the contents of a list are changed.

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

For a description of this member, see CopyTo(Array, Int32).

ICollection.Count
ICollection.IsSynchronized

For a description of this member, see IsSynchronized.

ICollection.SyncRoot

For a description of this member, see SyncRoot.

ICollection<TEntity>.IsReadOnly

For a description of this member, see IsReadOnly.

IEnumerable.GetEnumerator()

For a description of this member, see GetEnumerator().

IList.Add(Object)

For a description of this member, see Add(Object).

IList.Clear()
IList.Contains(Object)

For a description of this member, see Contains(Object).

IList.IndexOf(Object)

For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object)

For a description of this member, see Insert(Int32, Object).

IList.IsFixedSize

For a description of this member, see IsFixedSize.

IList.IsReadOnly

For a description of this member, see IsReadOnly.

IList.Item[Int32]

For a description of this member, see Item[Int32].

IList.Remove(Object)

For a description of this member, see Remove(Object).

IList.RemoveAt(Int32)
IListSource.ContainsListCollection

For a description of this member, see ContainsListCollection.

IListSource.GetList()

For a description of this member, see GetList().

Extension Methods

CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to