DataRelationCollection DataRelationCollection DataRelationCollection DataRelationCollection Class

定义

表示此 DataRelationDataSet 对象的集合。Represents the collection of DataRelation objects for this DataSet.

public ref class DataRelationCollection abstract : System::Data::InternalDataCollectionBase
[System.Serializable]
public abstract class DataRelationCollection : System.Data.InternalDataCollectionBase
type DataRelationCollection = class
    inherit InternalDataCollectionBase
Public MustInherit Class DataRelationCollection
Inherits InternalDataCollectionBase
继承
DataRelationCollectionDataRelationCollectionDataRelationCollectionDataRelationCollection
属性

注解

对象DataRelationCollection允许在相关的父/子DataTable对象之间进行导航。A DataRelationCollection object enables navigation between related parent/child DataTable objects.

您可以通过DataRelationCollection将对象定义为DataSetDataTable的属性(而不是直接使用构造函数)来创建对象。You create a DataRelationCollection object by defining it as a property of either the DataSet or the DataTable, instead of by directly using a constructor. (使用Relations的属性DataSetParentRelationsDataTable属性。)(Use the Relations property of the DataSet, or the ParentRelations property of the DataTable.)

若要访问该集合,请Relations使用DataSet对象的属性。To access the collection, use the Relations property of the DataSet object.

集合存在后,便可使用AddClearRemove等方法管理它所包含的对象。As soon as the collection exists you can manage the objects it contains by using methods such as Add, Clear, and Remove.

构造函数

DataRelationCollection() DataRelationCollection() DataRelationCollection() DataRelationCollection()

初始化 DataRelationCollection 类的新实例。Initializes a new instance of the DataRelationCollection class.

属性

Count Count Count Count

获取集合中的元素总数。Gets the total number of elements in a collection.

(Inherited from InternalDataCollectionBase)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示 InternalDataCollectionBase 是否为只读。Gets a value that indicates whether the InternalDataCollectionBase is read-only.

(Inherited from InternalDataCollectionBase)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

获取一个值,该值指示 InternalDataCollectionBase 是否已同步。Gets a value that indicates whether the InternalDataCollectionBase is synchronized.

(Inherited from InternalDataCollectionBase)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取位于指定索引位置的 DataRelation 对象。Gets the DataRelation object at the specified index.

Item[String] Item[String] Item[String] Item[String]

获取按名称指定的 DataRelation 对象。Gets the DataRelation object specified by name.

List List List List

获取作为列表的集合的项。Gets the items of the collection as a list.

(Inherited from InternalDataCollectionBase)
SyncRoot SyncRoot SyncRoot SyncRoot

获取可用于同步集合的对象。Gets an object that can be used to synchronize the collection.

(Inherited from InternalDataCollectionBase)

方法

Add(DataColumn, DataColumn) Add(DataColumn, DataColumn) Add(DataColumn, DataColumn) Add(DataColumn, DataColumn)

用指定的父列和子列创建 DataRelation,并将其添加到集合中。Creates a DataRelation with a specified parent and child column, and adds it to the collection.

Add(DataColumn[], DataColumn[]) Add(DataColumn[], DataColumn[]) Add(DataColumn[], DataColumn[]) Add(DataColumn[], DataColumn[])

用指定的父列和子列创建 DataRelation,并将其添加到集合中。Creates a DataRelation with the specified parent and child columns, and adds it to the collection.

Add(DataRelation) Add(DataRelation) Add(DataRelation) Add(DataRelation)

DataRelation 中添加一个 DataRelationCollectionAdds a DataRelation to the DataRelationCollection.

Add(String, DataColumn, DataColumn) Add(String, DataColumn, DataColumn) Add(String, DataColumn, DataColumn) Add(String, DataColumn, DataColumn)

用指定名称以及父列和子列创建 DataRelation,并将其添加到集合。Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.

Add(String, DataColumn, DataColumn, Boolean) Add(String, DataColumn, DataColumn, Boolean) Add(String, DataColumn, DataColumn, Boolean) Add(String, DataColumn, DataColumn, Boolean)

用指定的名称、父列和子列,以及根据 createConstraints 参数的值而定的可选约束创建 DataRelation,并将其添加到集合中。Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.

Add(String, DataColumn[], DataColumn[]) Add(String, DataColumn[], DataColumn[]) Add(String, DataColumn[], DataColumn[]) Add(String, DataColumn[], DataColumn[])

使用父列和子列数组创建一个具有指定名称的 DataRelation,并将其添加到集合中。Creates a DataRelation with the specified name and arrays of parent and child columns, and adds it to the collection.

Add(String, DataColumn[], DataColumn[], Boolean) Add(String, DataColumn[], DataColumn[], Boolean) Add(String, DataColumn[], DataColumn[], Boolean) Add(String, DataColumn[], DataColumn[], Boolean)

用指定的名称、父列和子列的数组以及指定是否创建约束的值,创建 DataRelation,并将其添加到集合。Creates a DataRelation with the specified name, arrays of parent and child columns, and value specifying whether to create a constraint, and adds it to the collection.

AddCore(DataRelation) AddCore(DataRelation) AddCore(DataRelation) AddCore(DataRelation)

对表执行验证。Performs verification on the table.

AddRange(DataRelation[]) AddRange(DataRelation[]) AddRange(DataRelation[]) AddRange(DataRelation[])

将指定的 DataRelation 数组的元素复制到集合末尾。Copies the elements of the specified DataRelation array to the end of the collection.

CanRemove(DataRelation) CanRemove(DataRelation) CanRemove(DataRelation) CanRemove(DataRelation)

验证是否可以将指定的 DataRelation 从集合中移除。Verifies whether the specified DataRelation can be removed from the collection.

Clear() Clear() Clear() Clear()

清除集合的所有关系。Clears the collection of any relations.

Contains(String) Contains(String) Contains(String) Contains(String)

验证集合中是否存在具有特定名称(不区分大小写)的 DataRelationVerifies whether a DataRelation with the specific name (case insensitive) exists in the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

将当前 InternalDataCollectionBase 的所有元素复制到一维 Array,从指定的 InternalDataCollectionBase 索引开始。Copies all the elements of the current InternalDataCollectionBase to a one-dimensional Array, starting at the specified InternalDataCollectionBase index.

(Inherited from InternalDataCollectionBase)
CopyTo(DataRelation[], Int32) CopyTo(DataRelation[], Int32) CopyTo(DataRelation[], Int32) CopyTo(DataRelation[], Int32)

从指定的索引开始复制 DataRelation 对象的集合。Copies the collection of DataRelation objects starting at the specified index.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetDataSet() GetDataSet() GetDataSet() GetDataSet()

此方法支持 .NET Framework 基础结构,但不适合直接在代码中使用。This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

获取集合的 IEnumeratorGets an IEnumerator for the collection.

(Inherited from InternalDataCollectionBase)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
IndexOf(DataRelation) IndexOf(DataRelation) IndexOf(DataRelation) IndexOf(DataRelation)

获取指定 DataRelation 对象的索引。Gets the index of the specified DataRelation object.

IndexOf(String) IndexOf(String) IndexOf(String) IndexOf(String)

获取按名称指定的 DataRelation 的索引。Gets the index of the DataRelation specified by name.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs) OnCollectionChanged(CollectionChangeEventArgs)

引发 CollectionChanged 事件。Raises the CollectionChanged event.

OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs) OnCollectionChanging(CollectionChangeEventArgs)

引发 CollectionChanged 事件。Raises the CollectionChanged event.

Remove(DataRelation) Remove(DataRelation) Remove(DataRelation) Remove(DataRelation)

从集合中移除指定的关系。Removes the specified relation from the collection.

Remove(String) Remove(String) Remove(String) Remove(String)

从集合中移除具有指定名称的关系。Removes the relation with the specified name from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

从集合中移除指定索引位置的关系。Removes the relation at the specified index from the collection.

RemoveCore(DataRelation) RemoveCore(DataRelation) RemoveCore(DataRelation) RemoveCore(DataRelation)

对指定 DataRelation 对象执行验证。Performs a verification on the specified DataRelation object.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

事件

CollectionChanged CollectionChanged CollectionChanged CollectionChanged

在集合更改后发生。Occurs when the collection has changed.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

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

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于

线程安全性

对于多线程读取操作,此类型是安全的。This type is safe for multithreaded read operations. 必须同步任何写入操作。You must synchronize any write operations.

另请参阅