EntitySet<TEntity> 类

定义

为 LINQ to SQL 应用程序中的一对多和一对一关系中的集合提供延迟加载和关系维护。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

类型参数

TEntity

目标实体的数据类型。The data type of the target entity.

继承
EntitySet<TEntity>
实现

注解

此类与EntityRef<TEntity>结合使用。This class is used in combination with EntityRef<TEntity>.

构造函数

EntitySet<TEntity>()

初始化 EntitySet<TEntity> 类的新实例。Initializes a new instance of the EntitySet<TEntity> class.

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

在为添加和移除操作提供处理程序的同时,初始化 EntitySet<TEntity> 类的新实例。Initializes a new instance of the EntitySet<TEntity> class while supplying handlers for add and remove operations.

属性

Count

获取 EntitySet<TEntity> 集合中的实体数。Gets the number of entities in the EntitySet<TEntity> collection.

HasAssignedValues
HasLoadedOrAssignedValues

指定 EntitySet<TEntity> 是否已加载或分配某值。Specifies whether the EntitySet<TEntity> has loaded or assigned a value.

HasLoadedValues
IsDeferred

指定此 EntitySet<TEntity> 是否具有尚未执行的延迟查询。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.

方法

Add(TEntity)

添加实体。Adds an entity.

AddRange(IEnumerable<TEntity>)

添加实体的集合。Adds a collection of entities.

Assign(IEnumerable<TEntity>)

EntitySet<TEntity> 集合分配给其他 EntitySet<TEntity> 集合。Assigns an EntitySet<TEntity> collection to another EntitySet<TEntity> collection.

Clear()

移除所有项。Removes all items.

Contains(TEntity)

指定 EntitySet<TEntity> 是否包含特定实体。Specifies whether the EntitySet<TEntity> contains a specific entity.

CopyTo(TEntity[], Int32)

EntitySet<TEntity> 复制到数组。Copies the EntitySet<TEntity> to an array.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEnumerator()

返回循环访问集合的枚举数。Returns an enumerator that iterates through a collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetNewBindingList()

创建用于绑定到数据源的新列表。Creates a new list for binding to a data source.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
IndexOf(TEntity)

返回实体的索引。Returns the index of the entity.

Insert(Int32, TEntity)

在索引位置处插入实体。Inserts an entity at an index position.

Load()

加载 EntitySet<TEntity>Loads the EntitySet<TEntity>.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Remove(TEntity)

移除实体。Removes an entity.

RemoveAt(Int32)

移除指定索引处的实体。Removes an entity at a specified index.

SetSource(IEnumerable<TEntity>)

设置 EntitySet<TEntity> 的源。Sets the source of the EntitySet<TEntity>.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

事件

ListChanged

当列表的内容发生更改时发生。Occurs when the contents of a list are changed.

显式界面实现

ICollection.CopyTo(Array, Int32)

有关此成员的说明,请参见 CopyTo(Array, Int32)For a description of this member, see CopyTo(Array, Int32).

ICollection.Count
ICollection.IsSynchronized

有关此成员的说明,请参见 IsSynchronizedFor a description of this member, see IsSynchronized.

ICollection.SyncRoot

有关此成员的说明,请参见 SyncRootFor a description of this member, see SyncRoot.

ICollection<TEntity>.IsReadOnly

有关此成员的说明,请参见 IsReadOnlyFor a description of this member, see IsReadOnly.

IEnumerable.GetEnumerator()

有关此成员的说明,请参见 GetEnumerator()For a description of this member, see GetEnumerator().

IList.Add(Object)

有关此成员的说明,请参见 Add(Object)For a description of this member, see Add(Object).

IList.Clear()
IList.Contains(Object)

有关此成员的说明,请参见 Contains(Object)For a description of this member, see Contains(Object).

IList.IndexOf(Object)

有关此成员的说明,请参见 IndexOf(Object)For a description of this member, see IndexOf(Object).

IList.Insert(Int32, Object)

有关此成员的说明,请参见 Insert(Int32, Object)For a description of this member, see Insert(Int32, Object).

IList.IsFixedSize

有关此成员的说明,请参见 IsFixedSizeFor a description of this member, see IsFixedSize.

IList.IsReadOnly

有关此成员的说明,请参见 IsReadOnlyFor a description of this member, see IsReadOnly.

IList.Item[Int32]

有关此成员的说明,请参见 Item[Int32]For a description of this member, see Item[Int32].

IList.Remove(Object)

有关此成员的说明,请参见 Remove(Object)For a description of this member, see Remove(Object).

IList.RemoveAt(Int32)
IListSource.ContainsListCollection

有关此成员的说明,请参见 ContainsListCollectionFor a description of this member, see ContainsListCollection.

IListSource.GetList()

有关此成员的说明,请参见 GetList()For a description of this member, see GetList().

扩展方法

CopyToDataTable<T>(IEnumerable<T>)

在给定其泛型参数 TDataTable 的输入 DataRow 对象的情况下,返回包含 IEnumerable<T> 对象副本的 DataRowReturns 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)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies 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)

在给定其泛型参数 TDataRow 的输入 DataTable 对象的情况下,将 IEnumerable<T> 对象复制到指定的 DataRowCopies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts 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. 集合中仅包括具有匹配 XName 的元素。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. 集合中仅包括具有匹配 XName 的元素。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. 集合中仅包括具有匹配 XName 的元素。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.

适用于