DataTableMapping 類別
定義
包含來源資料表與 DataTable 之間的對應關聯性描述。Contains a description of a mapped relationship between a source table and a DataTable. DataAdapter 在填入 DataSet 時會使用這個類別。This class is used by a DataAdapter when populating a DataSet.
public ref class DataTableMapping sealed : MarshalByRefObject, ICloneable, System::Data::ITableMapping
[System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataTableMapping/DataTableMappingConverter))]
public sealed class DataTableMapping : MarshalByRefObject, ICloneable, System.Data.ITableMapping
public sealed class DataTableMapping : MarshalByRefObject, ICloneable, System.Data.ITableMapping
[System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataTableMappingConverter))]
public sealed class DataTableMapping : MarshalByRefObject, ICloneable, System.Data.ITableMapping
[<System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataTableMapping/DataTableMappingConverter))>]
type DataTableMapping = class
inherit MarshalByRefObject
interface ITableMapping
interface ICloneable
type DataTableMapping = class
inherit MarshalByRefObject
interface ITableMapping
interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Data.Common.DataTableMappingConverter))>]
type DataTableMapping = class
inherit MarshalByRefObject
interface ITableMapping
interface ICloneable
Public NotInheritable Class DataTableMapping
Inherits MarshalByRefObject
Implements ICloneable, ITableMapping
- 繼承
- 屬性
- 實作
範例
下列範例 DataTableMapping 會建立物件,並將它加入至 DataTableMappingCollection 。The following example creates a DataTableMapping object and adds it to a DataTableMappingCollection. 然後,它會通知使用者,對應已新增至集合,並顯示父對應。It then informs the user that the mapping was added to the collection and displays the parent mapping.
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
備註
DataTableMapping提供針對資料來源的查詢所傳回的資料與之間的主要對應 DataTable 。A DataTableMapping provides a master mapping between the data returned from a query against a data source, and a DataTable. 您 DataTableMapping 可以將名稱取代 DataTable 為 Fill
DataAdapter 方法的名稱。The DataTableMapping name can be passed in place of the DataTable name to the Fill
method of the DataAdapter. 如需詳細資訊,請參閱 DataAdapter DataTable 和 DataColumn對應。For more information, see DataAdapter DataTable and DataColumn Mappings.
建構函式
DataTableMapping() |
初始化 DataTableMapping 類別的新執行個體。Initializes a new instance of the DataTableMapping class. |
DataTableMapping(String, String) |
使用在提供來源資料表名稱和 DataTableMapping 名稱時的來源來初始化 DataTable 類別的新執行個體。Initializes a new instance of the DataTableMapping class with a source when given a source table name and a DataTable name. |
DataTableMapping(String, String, DataColumnMapping[]) |
在提供來源資料表名稱、DataTableMapping 名稱和 DataTable 物件的陣列時,初始化 DataColumnMapping 類別的新執行個體。Initializes a new instance of the DataTableMapping class when given a source table name, a DataTable name, and an array of DataColumnMapping objects. |
屬性
ColumnMappings |
取得 DataColumnMappingCollection 的 DataTable。Gets the DataColumnMappingCollection for the DataTable. |
DataSetTable |
從 DataSet 取得或設定資料表名稱。Gets or sets the table name from a DataSet. |
SourceTable |
從資料來源取得或設定區分大小寫的來源資料表名稱。Gets or sets the case-sensitive source table name from a data source. |
方法
CreateObjRef(Type) |
建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。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) |
GetColumnMappingBySchemaAction(String, MissingMappingAction) |
使用指定的 DataColumn 值和 DataTable 的名稱來從指定的 MissingMappingAction 取得 DataColumn。Gets a DataColumn from the specified DataTable using the specified MissingMappingAction value and the name of the DataColumn. |
GetDataColumn(String, Type, DataTable, MissingMappingAction, MissingSchemaAction) |
傳回指定資料行名稱的 DataColumn 物件。Returns a DataColumn object for a given column name. |
GetDataTableBySchemaAction(DataSet, MissingSchemaAction) |
使用指定的 DataTable 值來為指定 DataSet 取得目前的 MissingSchemaAction。Gets the current DataTable for the specified DataSet using the specified MissingSchemaAction value. |
GetHashCode() |
做為預設雜湊函式。Serves as the default hash function. (繼承來源 Object) |
GetLifetimeService() |
已過時。
擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。Retrieves the current lifetime service object that controls the lifetime policy for this instance. (繼承來源 MarshalByRefObject) |
GetType() |
取得目前執行個體的 Type。Gets the Type of the current instance. (繼承來源 Object) |
InitializeLifetimeService() |
已過時。
取得存留期服務物件,以控制這個執行個體的存留期原則。Obtains a lifetime service object to control the lifetime policy for this instance. (繼承來源 MarshalByRefObject) |
MemberwiseClone() |
建立目前 Object 的淺層複製。Creates a shallow copy of the current Object. (繼承來源 Object) |
MemberwiseClone(Boolean) |
建立目前 MarshalByRefObject 物件的淺層複本。Creates a shallow copy of the current MarshalByRefObject object. (繼承來源 MarshalByRefObject) |
ToString() |
將目前的 SourceTable 名稱轉換為字串。Converts the current SourceTable name to a string. |
明確介面實作
ICloneable.Clone() |
建立目前執行個體複本的新物件。Creates a new object that is a copy of the current instance. |
ITableMapping.ColumnMappings |
為 DataColumnMappingCollection 取得衍生的 DataTable。Gets the derived DataColumnMappingCollection for the DataTable. |