Edit

Share via


DataTableMapping Class

Definition

Contains a description of a mapped relationship between a source table and a DataTable. 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
Inheritance
DataTableMapping
Attributes
Implements

Examples

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

Remarks

A DataTableMapping provides a primary mapping between the data returned from a query against a data source, and a DataTable. The DataTableMapping name can be passed in place of the DataTable name to the Fill method of the DataAdapter. For more information, see DataAdapter DataTable and DataColumn Mappings.

Constructors

DataTableMapping()

Initializes a new instance of the DataTableMapping class.

DataTableMapping(String, String)

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[])

Initializes a new instance of the DataTableMapping class when given a source table name, a DataTable name, and an array of DataColumnMapping objects.

Properties

ColumnMappings

Gets the DataColumnMappingCollection for the DataTable.

DataSetTable

Gets or sets the table name from a DataSet.

SourceTable

Gets or sets the case-sensitive source table name from a data source.

Methods

CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetColumnMappingBySchemaAction(String, MissingMappingAction)

Gets a DataColumn from the specified DataTable using the specified MissingMappingAction value and the name of the DataColumn.

GetDataColumn(String, Type, DataTable, MissingMappingAction, MissingSchemaAction)

Returns a DataColumn object for a given column name.

GetDataTableBySchemaAction(DataSet, MissingSchemaAction)

Gets the current DataTable for the specified DataSet using the specified MissingSchemaAction value.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()
Obsolete.

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService()
Obsolete.

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString()

Converts the current SourceTable name to a string.

Explicit Interface Implementations

ICloneable.Clone()

Creates a new object that is a copy of the current instance.

ITableMapping.ColumnMappings

Gets the derived DataColumnMappingCollection for the DataTable.

Applies to

See also