.NET Framework Class Library IColumnMappingCollection Interface Contains a collection of DataColumnMapping objects, and is implemented by the DataColumnMappingCollection, which is used in common by .NET Framework data providers.
Namespace:
System.Data
Assembly:
System.Data (in System.Data.dll)

Syntax
Public Interface IColumnMappingCollection _
Inherits IList, ICollection, IEnumerable
public interface IColumnMappingCollection : IList,
ICollection, IEnumerable
public interface class IColumnMappingCollection : IList,
ICollection, IEnumerable
type IColumnMappingCollection =
interface
interface IList
interface ICollection
interface IEnumerable
end
The IColumnMappingCollection type exposes the following members.

Properties

Methods

Extension Methods

Remarks
The IColumnMappingCollection interface enables an inheriting class to implement a ColumnMapping collection. For more information, see DataAdapter DataTable and DataColumn Mappings (ADO.NET). An application does not create an instance of the IColumnMappingCollection interface directly, but creates an instance of a class that inherits IColumnMappingCollection. Classes that inherit IColumnMappingCollection must implement all inherited members, and typically define additional members to add provider-specific functionality. For example, the IColumnMappingCollection interface defines the RemoveAt method. In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt. Notes to ImplementersWhen you inherit from the IColumnMappingCollection interface, you should implement the following constructor: Item | Description |
|---|
ColumnMappingCollection() | Creates an empty ColumnMappingCollection class. |

Examples
The following example uses an instance of the derived class, DataTableMapping, to Add several DataColumnMapping objects to its ColumnMappings collection, and then displays a list of those mapped source tables. This example assumes that a DataTableMapping has already been created.
Public Sub ShowColumnMappings()
' ...
' create tableMapping
' ...
tableMapping.ColumnMappings.Add( _
"Category Name", "DataCategory")
tableMapping.ColumnMappings.Add( _
"Description", "DataDescription")
tableMapping.ColumnMappings.Add( _
"Picture", "DataPicture")
Console.WriteLine("Column Mappings:")
Dim i As Integer
For i = 0 To tableMapping.ColumnMappings.Count - 1
Console.WriteLine(" {0} {1}", i, _
tableMapping.ColumnMappings(i).ToString())
Next i
End Sub
public void ShowColumnMappings()
{
// ...
// create tableMapping
// ...
tableMapping.ColumnMappings.Add("Category Name","DataCategory");
tableMapping.ColumnMappings.Add("Description","DataDescription");
tableMapping.ColumnMappings.Add("Picture","DataPicture");
Console.WriteLine("Column Mappings");
for(int i=0;i < tableMapping.ColumnMappings.Count;i++)
{
Console.WriteLine(" {0} {1}", i,
tableMapping.ColumnMappings[i].ToString());
}
}

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Biblioteca de clases de .NET Framework IColumnMappingCollection (Interfaz) Contiene una colección de objetos DataColumnMapping y la implementa DataColumnMappingCollection, que utiliza todos los proveedores de datos de .NET Framework.
Espacio de nombres:
System.Data
Ensamblado:
System.Data (en System.Data.dll)

Sintaxis
Public Interface IColumnMappingCollection _
Inherits IList, ICollection, IEnumerable
public interface IColumnMappingCollection : IList,
ICollection, IEnumerable
public interface class IColumnMappingCollection : IList,
ICollection, IEnumerable
type IColumnMappingCollection =
interface
interface IList
interface ICollection
interface IEnumerable
end
El tipo IColumnMappingCollection expone los siguientes miembros.

Propiedades

Métodos

Métodos de extensión

Comentarios
La interfaz IColumnMappingCollection permite a una clase heredada implementar una colección ColumnMapping. Para obtener más información, vea Asignaciones DataAdapter, DataTable y DataColumn (ADO.NET). Una aplicación no crea una instancia de la interfaz IColumnMappingCollection directamente, sino que la crea de una clase que hereda de IColumnMappingCollection. Las clases que heredan IColumnMappingCollection deben implementar todos los miembros heredados y suelen definir miembros adicionales para agregar la funcionalidad específica de proveedor. Por ejemplo, la interfaz IColumnMappingCollection define el método RemoveAt. A su vez, la clase DataTableMappingCollection hereda este método y define dos sobrecargas adicionales de RemoveAt. Notas para los implementadoresAl heredar de la interfaz IColumnMappingCollection, se debe implementar el constructor siguiente: Elemento | Descripción |
|---|
ColumnMappingCollection() | Crea una clase ColumnMappingCollection vacía. |

Ejemplos
En el ejemplo siguiente se utiliza una instancia de la clase derivada DataTableMapping para agregar mediante Add varios objetos DataColumnMapping a la colección ColumnMappings y, a continuación, se muestra una lista de esas tablas de origen asignadas. En este ejemplo se supone que ya se ha creado un objeto DataTableMapping.
Public Sub ShowColumnMappings()
' ...
' create tableMapping
' ...
tableMapping.ColumnMappings.Add( _
"Category Name", "DataCategory")
tableMapping.ColumnMappings.Add( _
"Description", "DataDescription")
tableMapping.ColumnMappings.Add( _
"Picture", "DataPicture")
Console.WriteLine("Column Mappings:")
Dim i As Integer
For i = 0 To tableMapping.ColumnMappings.Count - 1
Console.WriteLine(" {0} {1}", i, _
tableMapping.ColumnMappings(i).ToString())
Next i
End Sub
public void ShowColumnMappings()
{
// ...
// create tableMapping
// ...
tableMapping.ColumnMappings.Add("Category Name","DataCategory");
tableMapping.ColumnMappings.Add("Description","DataDescription");
tableMapping.ColumnMappings.Add("Picture","DataPicture");
Console.WriteLine("Column Mappings");
for(int i=0;i < tableMapping.ColumnMappings.Count;i++)
{
Console.WriteLine(" {0} {1}", i,
tableMapping.ColumnMappings[i].ToString());
}
}

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Vea también
|