Upraviť

Zdieľať cez


DataTableMappingCollection Class

Definition

A collection of DataTableMapping objects. This class cannot be inherited.

public ref class DataTableMappingCollection sealed : MarshalByRefObject, System::Collections::IList, System::Data::ITableMappingCollection
public ref class DataTableMappingCollection sealed : MarshalByRefObject, System::Data::ITableMappingCollection
[System.ComponentModel.ListBindable(false)]
public sealed class DataTableMappingCollection : MarshalByRefObject, System.Collections.IList, System.Data.ITableMappingCollection
[System.ComponentModel.ListBindable(false)]
public sealed class DataTableMappingCollection : MarshalByRefObject, System.Data.ITableMappingCollection
[<System.ComponentModel.ListBindable(false)>]
type DataTableMappingCollection = class
    inherit MarshalByRefObject
    interface ICollection
    interface IEnumerable
    interface IList
    interface ITableMappingCollection
[<System.ComponentModel.ListBindable(false)>]
type DataTableMappingCollection = class
    inherit MarshalByRefObject
    interface ITableMappingCollection
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class DataTableMappingCollection
Inherits MarshalByRefObject
Implements IList, ITableMappingCollection
Public NotInheritable Class DataTableMappingCollection
Inherits MarshalByRefObject
Implements ITableMappingCollection
Inheritance
DataTableMappingCollection
Attributes
Implements

Examples

The following example uses an OleDbDataAdapter to AddDataTableMapping objects to its TableMappings collection, and then displays a list of those mapped source tables. 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

Constructors

DataTableMappingCollection()

Initializes a new instance of the DataTableMappingCollection class. This new instance is empty, that is, it does not yet contain any DataTableMapping objects.

Properties

Count

Gets the number of DataTableMapping objects in the collection.

Item[Int32]

Gets or sets the DataTableMapping object at the specified index.

Item[String]

Gets or sets the DataTableMapping object with the specified source table name.

Methods

Add(Object)

Adds an Object that is a table mapping to the collection.

Add(String, String)

Adds a DataTableMapping object to the collection when given a source table name and a DataSet table name.

AddRange(Array)

Copies the elements of the specified Array to the end of the collection.

AddRange(DataTableMapping[])

Copies the elements of the specified DataTableMapping array to the end of the collection.

Clear()

Removes all DataTableMapping objects from the collection.

Contains(Object)

Gets a value indicating whether the given DataTableMapping object exists in the collection.

Contains(String)

Gets a value indicating whether a DataTableMapping object with the specified source table name exists in the collection.

CopyTo(Array, Int32)

Copies the elements of the DataTableMappingCollection to the specified array.

CopyTo(DataTableMapping[], Int32)

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.

(Inherited from MarshalByRefObject)
Equals(Object)

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

(Inherited from Object)
GetByDataSetTable(String)

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.

(Inherited from Object)
GetLifetimeService()
Obsolete.

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

(Inherited from MarshalByRefObject)
GetTableMappingBySchemaAction(DataTableMappingCollection, String, String, MissingMappingAction)

Gets a DataColumnMapping object with the specified source table name and DataSet table name, using the given MissingMappingAction.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
IndexOf(Object)

Gets the location of the specified DataTableMapping object within the collection.

IndexOf(String)

Gets the location of the DataTableMapping object with the specified source table name.

IndexOfDataSetTable(String)

Gets the location of the DataTableMapping object with the specified DataSet table name.

InitializeLifetimeService()
Obsolete.

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

(Inherited from MarshalByRefObject)
Insert(Int32, DataTableMapping)

Inserts a DataTableMapping object into the DataTableMappingCollection at the specified index.

Insert(Int32, Object)

Inserts a DataTableMapping object into the DataTableMappingCollection at the specified index.

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)
Remove(DataTableMapping)

Removes the specified DataTableMapping object from the collection.

Remove(Object)

Removes the specified DataTableMapping object from the collection.

RemoveAt(Int32)

Removes the DataTableMapping object located at the specified index from the collection.

RemoveAt(String)

Removes the DataTableMapping object with the specified source table name from the collection.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.IsSynchronized

Gets a value indicating whether access to the ICollection is synchronized (thread safe).

ICollection.SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

IList.IsFixedSize

Gets a value indicating whether the IList has a fixed size.

IList.IsReadOnly

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)

Gets the TableMapping object with the specified DataSet table name.

ITableMappingCollection.Item[String]

Gets or sets the instance of ITableMapping with the specified SourceTable name.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to