System.Data Namespace
Contains a collection of TableMapping objects, and is implemented by the DataTableMappingCollection, which is used in common by .NET data providers.
Visibility |
Name |
Value Type |
Accessibility |
public |
Item
( String
index )
|
Object |
[ Get , Set ] |
|
The ITableMappingCollection interface allows an inheriting class to implement a TableMapping collection. For more information, see Setting Up DataTable and DataColumn Mappings.
An application does not create an instance of the ITableMappingCollection interface directly, but initializes an instance of a class that inherits ITableMappingCollection.
Classes that inherit ITableMappingCollection must implement the inherited members, and typically define additional members to add provider-specific functionality. For example, the ITableMappingCollection interface defines one implementation of the RemoveAt method. In turn, the DataTableMappingCollection class inherits this method, and defines two additional overloads of RemoveAt.
Notes to Implementers: When you inherit from the ITableMappingCollection interface, you should implement the following constructor:
Item |
Description |
PrvTableMappingCollection ( ) |
Initializes an empty PrvTableMappingCollection class. |
The following example initializes an instance of the derived class, DataTableMapping, and adds it to a DataTableMappingCollection . It then informs the user that the mapping was added to the collection and displays the Parent property.
void AddDataTableMapping ( ) {
// ... create myTableMappings ...
DataTableMapping myNewMapping =
new DataTableMapping ( "Categories","DataCategories" );
myTableMappings.Add ( ( Object ) myNewMapping );
Response.Write ( "Table " + myNewMapping.ToString ( ) +
" added to " + "table mapping collection " +
myTableMappings.ToString ( ) );
}
Public Sub AddDataTableMapping ( )
' ... create myTableMappings ...
Dim myNewMapping As New _
DataTableMapping ( "Categories", "DataCategories" )
myTableMappings.Add ( CType ( myNewMapping, Object ) )
Response.Write ( "Table " & myNewMapping.ToString ( ) & _
" added to " & "table mapping collection " & _
myTableMappings.ToString ( ) )
End Sub |
|
C# |
VB |