DataTableMappingCollection 类

定义

DataTableMapping 对象的集合。A collection of DataTableMapping objects. 此类不能被继承。This class cannot be inherited.

public ref class DataTableMappingCollection sealed : MarshalByRefObject, System::Collections::IList, System::Data::ITableMappingCollection
[System.ComponentModel.ListBindable(false)]
public sealed class DataTableMappingCollection : MarshalByRefObject, System.Collections.IList, System.Data.ITableMappingCollection
type DataTableMappingCollection = class
    inherit MarshalByRefObject
    interface ITableMappingCollection
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class DataTableMappingCollection
Inherits MarshalByRefObject
Implements IList, ITableMappingCollection
继承
DataTableMappingCollection
属性
实现

示例

下面的示例OleDbDataAdapter使用到Add DataTableMapping对象TableMappings的集合, 然后显示这些映射的源表的列表。The following example uses an OleDbDataAdapter to AddDataTableMapping objects to its TableMappings collection, and then displays a list of those mapped source tables. 此示例假定OleDbDataAdapter已创建了。This example assumes that an OleDbDataAdapter has already been created.

public void ShowTableMappings() 
{
    // ...
    // create adapter
    // ...
    adapter.TableMappings.Add("Categories","DataCategories");
    adapter.TableMappings.Add("Orders","DataOrders");
    adapter.TableMappings.Add("Products","DataProducts");
    string message = "Table Mappings:\n";
    for(int i=0;i < adapter.TableMappings.Count;i++) 
    {
        message += i.ToString() + " "
            + adapter.TableMappings[i].ToString() + "\n";
    }
    Console.WriteLine(message);
}
Public Sub ShowTableMappings()
    ' ...
    ' create adapter
    ' ...
    adapter.TableMappings.Add("Categories", "DataCategories")
    adapter.TableMappings.Add("Orders", "DataOrders")
    adapter.TableMappings.Add("Products", "DataProducts")
    Dim message As String = "Table Mappings:" & ControlChars.Cr
    Dim i As Integer
    For i = 0 To adapter.TableMappings.Count - 1
        message &= i.ToString() & " " _
           & adapter.TableMappings(i).ToString() & ControlChars.Cr
    Next i
    Console.WriteLine(message)
End Sub

构造函数

DataTableMappingCollection()

初始化 DataTableMappingCollection 类的新实例。Initializes a new instance of the DataTableMappingCollection class. 此新实例为空,即它尚未包含任何 DataTableMapping 对象。This new instance is empty, that is, it does not yet contain any DataTableMapping objects.

属性

Count

获取集合中 DataTableMapping 对象的数量。Gets the number of DataTableMapping objects in the collection.

Item[Int32]

获取或设置位于指定索引处的 DataTableMapping 对象。Gets or sets the DataTableMapping object at the specified index.

Item[String]

获取或设置具有指定源表名称的 DataTableMapping 对象。Gets or sets the DataTableMapping object with the specified source table name.

方法

Add(Object)

添加 Object,它是集合的表映射。Adds an Object that is a table mapping to the collection.

Add(String, String)

给定源表名称和 DataSet 表名时,向集合添加 DataTableMapping 对象。Adds a DataTableMapping object to the collection when given a source table name and a DataSet table name.

AddRange(Array)

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

AddRange(DataTableMapping[])

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

Clear()

从集合中删除所有 DataTableMapping 对象。Removes all DataTableMapping objects from the collection.

Contains(Object)

获取一个值,该值指示集合中是否存在给定的 DataTableMapping 对象。Gets a value indicating whether the given DataTableMapping object exists in the collection.

Contains(String)

获取一个值,该值指示集合中是否存在具有指定源表名称的 DataTableMapping 对象。Gets a value indicating whether a DataTableMapping object with the specified source table name exists in the collection.

CopyTo(Array, Int32)

DataTableMappingCollection 的元素复制到指定的数组。Copies the elements of the DataTableMappingCollection to the specified array.

CopyTo(DataTableMapping[], Int32)

DataTableMapping 的元素复制到指定的数组。Copies the elements of the DataTableMapping to the specified array.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Equals(Object)

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

(继承自 Object)
GetByDataSetTable(String)

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

GetEnumerator()

获取可循环访问集合的枚举数。Gets an enumerator that can iterate through the collection.

GetHashCode()

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

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetTableMappingBySchemaAction(DataTableMappingCollection, String, String, MissingMappingAction)

使用给定的 MissingMappingAction 获取具有指定源表名称和 DataSet 表名称的 DataColumnMapping 对象。Gets a DataColumnMapping object with the specified source table name and DataSet table name, using the given MissingMappingAction.

GetType()

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

(继承自 Object)
IndexOf(Object)

获取指定的 DataTableMapping 对象在集合中的位置。Gets the location of the specified DataTableMapping object within the collection.

IndexOf(String)

获取具有指定源表名称的 DataTableMapping 对象的位置。Gets the location of the DataTableMapping object with the specified source table name.

IndexOfDataSetTable(String)

获取具有指定的 DataSet 表名称的 DataTableMapping 对象的位置。Gets the location of the DataTableMapping object with the specified DataSet table name.

InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
Insert(Int32, DataTableMapping)

DataTableMapping 中的指定索引处插入一个 DataTableMappingCollection 对象。Inserts a DataTableMapping object into the DataTableMappingCollection at the specified index.

Insert(Int32, Object)

DataTableMapping 中的指定索引处插入一个 DataTableMappingCollection 对象。Inserts a DataTableMapping object into the DataTableMappingCollection at the specified index.

MemberwiseClone()

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

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
Remove(DataTableMapping)

从集合中移除指定的 DataTableMapping 对象。Removes the specified DataTableMapping object from the collection.

Remove(Object)

从集合中移除指定的 DataTableMapping 对象。Removes the specified DataTableMapping object from the collection.

RemoveAt(Int32)

从集合中移除位于指定索引处的 DataTableMapping 对象。Removes the DataTableMapping object located at the specified index from the collection.

RemoveAt(String)

从集合中移除具有指定源表名称的 DataTableMapping 对象。Removes the DataTableMapping object with the specified source table name from the collection.

ToString()

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

(继承自 Object)

显式界面实现

ICollection.IsSynchronized

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

ICollection.SyncRoot

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

IList.IsFixedSize

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

IList.IsReadOnly

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

IList.Item[Int32]

获取或设置指定索引处的集合中的项。Gets or sets an item from the collection at a specified index.

ITableMappingCollection.Add(String, String)

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

ITableMappingCollection.GetByDataSetTable(String)

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

ITableMappingCollection.Item[String]

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

扩展方法

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.

适用于