ITableMappingCollection Interface


包含 TableMapping 对象的集合,并由 DataTableMappingCollection(通常由 .NET Framework 数据提供程序共同使用)实现。Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET Framework data providers.

public interface class ITableMappingCollection : System::Collections::IList
public interface ITableMappingCollection : System.Collections.IList
type ITableMappingCollection = interface
    interface ICollection
    interface IEnumerable
    interface IList
type ITableMappingCollection = interface
    interface IList
    interface ICollection
    interface IEnumerable
Public Interface ITableMappingCollection
Implements IList


下面的示例创建派生类的实例,DataTableMapping,并将其添加到 DataTableMappingCollection 集合。The following example creates an instance of the derived class, DataTableMapping, and adds it to a DataTableMappingCollection collection. 然后,它会通知用户已将映射添加到集合。It then informs the user that the mapping was added to the collection.

public void AddDataTableMapping()
    // ...
    // create tableMappings
    // ...
    DataTableMapping mapping =
        new DataTableMapping("Categories","DataCategories");
    tableMappings.Add((Object) mapping);
    Console.WriteLine("Table {0} added to {1} table mapping collection.",
        mapping.ToString(), tableMappings.ToString());
Public Sub AddDataTableMapping()
    ' ...
    ' create tableMappings
    ' ...
    Dim mapping As New DataTableMapping( _
       "Categories", "DataCategories")
    tableMappings.Add(CType(mapping, Object))
    Console.WriteLine( _
       "Table {0} added to {1} table mapping collection.", _
       mapping.ToString(), tableMappings.ToString())
End Sub


ITableMappingCollection 接口允许继承类实现 TableMapping 集合。The ITableMappingCollection interface allows an inheriting class to implement a TableMapping collection. 有关详细信息,请参阅DataAdapter DataTable And DataColumn 映射For more information, see DataAdapter DataTable and DataColumn Mappings.

应用程序不会直接创建 ITableMappingCollection 接口的实例,而是创建继承 ITableMappingCollection的类的实例。An application does not create an instance of the ITableMappingCollection interface directly, but creates an instance of a class that inherits ITableMappingCollection.

继承 ITableMappingCollection 的类必须实现继承成员,并且通常定义其他成员来添加特定于提供程序的功能。Classes that inherit ITableMappingCollection must implement the inherited members, and typically define additional members to add provider-specific functionality. 例如,ITableMappingCollection 接口定义 RemoveAt 方法的一个实现。For example, the ITableMappingCollection interface defines one implementation of the RemoveAt method. 反过来,DataTableMappingCollection 类继承了此方法,并定义了 RemoveAt的两个附加重载。In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt.

Notes to Implementers

当从 ITableMappingCollection 接口继承时,应实现以下构造函数:When you inherit from the ITableMappingCollection interface, you should implement the following constructor:

Item 说明Description
PrvTableMappingCollection()PrvTableMappingCollection() 创建一个空的 PrvTableMappingCollection 类。Creates an empty PrvTableMappingCollection class.



获取 ICollection 中包含的元素数。Gets the number of elements contained in the ICollection.

(Inherited from ICollection)

获取一个值,该值指示 IList 是否具有固定大小。Gets a value indicating whether the IList has a fixed size.

(Inherited from IList)

获取一个值,用于指示 IList 是否为只读。Gets a value indicating whether the IList is read-only.

(Inherited from IList)

获取一个值,该值指示是否同步对 ICollection 的访问(线程安全)。Gets a value indicating whether access to the ICollection is synchronized (thread safe).

(Inherited from ICollection)

获取或设置指定索引处的元素。Gets or sets the element at the specified index.

(Inherited from IList)

获取或设置具有指定 SourceTable 名称的 ITableMapping 的实例。Gets or sets the instance of ITableMapping with the specified SourceTable name.


获取可用于同步对 ICollection 的访问的对象。Gets an object that can be used to synchronize access to the ICollection.

(Inherited from ICollection)



将项添加到 IList 中。Adds an item to the IList.

(Inherited from IList)
Add(String, String)

向集合添加表映射。Adds a table mapping to the collection.


IList 中移除所有项。Removes all items from the IList.

(Inherited from IList)

确定 IList 是否包含特定值。Determines whether the IList contains a specific value.

(Inherited from IList)

获取一个值,该值指示集合是否包含具有指定源表名称的表映射。Gets a value indicating whether the collection contains a table mapping with the specified source table name.

CopyTo(Array, Int32)

从特定的 ICollection 索引开始,将 Array 的元素复制到一个 Array 中。Copies the elements of the ICollection to an Array, starting at a particular Array index.

(Inherited from ICollection)

获取具有指定的 DataSet 表名的 TableMapping 对象。Gets the TableMapping object with the specified DataSet table name.


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

(Inherited from IEnumerable)

确定 IList 中特定项的索引。Determines the index of a specific item in the IList.

(Inherited from IList)

获取 ITableMapping 对象在集合内的位置。Gets the location of the ITableMapping object within the collection.

Insert(Int32, Object)

将项插入到 IList 中的指定索引处。Inserts an item to the IList at the specified index.

(Inherited from IList)

IList 中删除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the IList.

(Inherited from IList)

移除位于指定索引处的 IList 项。Removes the IList item at the specified index.

(Inherited from IList)

从集合中移除具有指定 SourceTable 名称的 ITableMapping 对象。Removes the ITableMapping object with the specified SourceTable name from the collection.

Extension Methods


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


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


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


IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

Applies to