The OracleBulkCopyColumnMappingCollection
class represents a collection of OracleBulkCopyColumnMapping
objects that are used to map columns in the data source to columns in a destination table.
System.Object
System.CollectionBase
System.OracleBulkCopyColumnMappingCollection
// C# public sealed class OracleBulkCopyColumnMappingCollection : CollectionBase
All public static methods are thread-safe, although instance methods do not guarantee thread safety.
Column mappings define the mapping between data source and the target table.
It is not necessary to specify column mappings for all the columns in the data source. If a ColumnMapping
is not specified, then, by default, columns are mapped based on the ordinal position. This succeeds only if the source and destination table schema match. If there is a mismatch, an InvalidOperationException
is thrown.
All the mappings in a mapping collection must be by name or ordinal position.
Note:
Oracle Data Provider for .NET makes one or more round-trips to the database to determine the column name if the mapping is specified by ordinal position. To avoid this performance overhead, specify the mapping by column name.// C#
Namespace: Oracle.DataAccess.Client
Assembly: Oracle.DataAccess.dll
ODP.NET Version: ODP.NET for .NET Framework 2.0 or ODP.NET for .NET Framework 4
See Also:
OracleBulkCopyColumnMappingCollection
members are listed in the following tables.
OracleBulkCopyColumnMappingCollection Properties
The OracleBulkCopyColumnMappingCollection
properties are listed in Table 17-11.
Table 17-11 OracleBulkCopyColumnMappingCollection Properties
Property | Description |
---|---|
Gets or sets the |
OracleBulkCopyColumnMappingCollection Public Methods
The OracleBulkCopyColumnMappingCollection
public methods are listed in Table 17-12.
Table 17-12 OracleBulkCopyColumnMappingCollection Public Methods
Public Method | Description |
---|---|
Adds objects to the collection |
|
Clears the contents of the collection |
|
Returns a value indicating whether or not a specified |
|
Copies the elements of the |
|
Returns the index of the specified |
|
Inserts a new |
|
Removes the specified |
|
Removes the mapping from the collection at the specified index. |
The OracleBulkCopyColumnMappingCollection
properties are listed in Table 17-13.
Table 17-13 OracleBulkCopyColumnMappingCollection Properties
Property | Description |
---|---|
Gets or sets the |
See Also:
This property gets or sets the OracleBulkCopyColumnMapping
object at the specified index.
// C#
public OracleBulkCopyColumnMapping this[int index] {get;set;}
index
The zero-based index of the OracleBulkCopyColumnMapping
being set or retrieved.
An OracleBulkCopyColumnMapping
object at the specified index.
IndexOutOfRangeException
- The specified index does not exist.
The OracleBulkCopyColumnMappingCollection
public methods are listed in Table 17-14.
Table 17-14 OracleBulkCopyColumnMappingCollection Public Methods
Public Method | Description |
---|---|
Adds objects to the collection |
|
Clears the contents of the collection |
|
Returns a value indicating whether or not a specified |
|
Copies the elements of the |
|
Returns the index of the specified |
|
Inserts a new |
|
Removes the specified |
|
Removes the mapping from the collection at the specified index. |
See Also:
Add methods add objects to the collection.
Add(OracleBulkCopyColumnMapping)
This method adds the supplied OracleBulkCopyColumnMapping
object to the collection.
This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source and destination column ordinal positions.
This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source column ordinal and destination column name.
This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source column name and destination column ordinal.
This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source and destination column names.
This method adds the supplied OracleBulkCopyColumnMapping
object to the collection.
// C#
public OracleBulkCopyColumnMapping Add(OracleBulkCopyColumnMapping bulkCopyColumnMapping);
bulkCopyColumnMapping
The OracleBulkCopyColumnMapping
object that describes the mapping to be added to the collection.
InvalidOperationException
- The bulk copy operation is in progress.
This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source and destination column ordinal positions.
// C# public OracleBulkCopyColumnMapping Add(int sourceColumnIndex, int destinationColumnIndex);
sourceColumnIndex
The ordinal position of the source column within the data source.
destinationColumnIndex
The ordinal position of the destination column within the destination table.
InvalidOperationException
- The bulk copy operation is in progress.
The newly created OracleBulkCopyColumnMapping
object that was added to the collection.
It is not necessary to specify column mappings for all the columns in the data source. If a ColumnMapping
is not specified, then, by default, columns are mapped based on the ordinal position. This succeeds only if the source and destination table schema match. If there is a mismatch, an InvalidOperationException
is thrown.
All the mappings in a mapping collection must be by name or ordinal position.
Note:
Oracle Data Provider for .NET makes one or more round-trips to the database to determine the column name if the mapping is specified by ordinal position. To avoid this performance overhead, specify the mapping by column name.This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source column ordinal and destination column name.
// C# public OracleBulkCopyColumnMapping Add(int sourceColumnIndex, string destinationColumn);
sourceColumnIndex
The ordinal position of the source column within the data source.
destinationColumn
The name of the destination column within the destination table.
InvalidOperationException
- The bulk copy operation is in progress.
The newly created OracleBulkCopyColumnMapping
object that was added to the collection.
It is not necessary to specify column mappings for all the columns in the data source. If a ColumnMapping
is not specified, then, by default, columns are mapped based on the ordinal position. This succeeds only if the source and destination table schema match. If there is a mismatch, an InvalidOperationException
is thrown.
All the mappings in a mapping collection must be by name or ordinal position.
Note:
Oracle Data Provider for .NET makes one or more round trips to the database to determine the column names if the mapping is specified by ordinal resulting in a performance overhead. Therefore, it is recommended to specify the mapping by column names.This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source column name and destination column ordinal.
// C# public OracleBulkCopyColumnMapping Add(string sourceColumn, int destinationColumnIndex);
sourceColumn
The name of the source column within the data source.
destinationColumnIndex
The ordinal position of the destination column within the destination table.
The newly created OracleBulkCopyColumnMapping
object that was added to the collection.
InvalidOperationException
- The bulk copy operation is in progress.
It is not necessary to specify column mappings for all the columns in the data source. If a ColumnMapping
is not specified, then, by default, columns are mapped based on the ordinal position. This succeeds only if the source and destination table schema match. If there is a mismatch, an InvalidOperationException
is thrown.
All the mappings in a mapping collection must be by name or ordinal position.
Note:
Oracle Data Provider for .NET makes one or more round trips to the database to determine the column names if the mapping is specified by ordinal resulting in a performance overhead. Therefore, it is recommended to specify the mapping by column names.This method creates and adds an OracleBulkCopyColumnMapping
object to the collection using the supplied source and destination column names.
// C# public OracleBulkCopyColumnMapping Add(string sourceColumn, string destinationColumn);
sourceColumn
The name of the source column within the data source.
destinationColumn
The name of the destination column within the destination table.
InvalidOperationException
- The bulk copy operation is in progress.
The newly created OracleBulkCopyColumnMapping
object that was added to the collection.
It is not necessary to specify column mappings for all the columns in the data source. If a ColumnMapping
is not specified, then, by default, columns are mapped based on the ordinal position. This succeeds only if the source and destination table schema match. If there is a mismatch, an InvalidOperationException
is thrown.
All the mappings in a mapping collection must be by name or ordinal position.
Note:
Oracle Data Provider for .NET makes one or more round-trips to the database to determine the column name if the mapping is specified by ordinal position. To avoid this performance overhead, specify the mapping by column name.This method clears the contents of the collection.
// C# public void Clear();
InvalidOperationException
- The bulk copy operation is in progress.
The Clear
method is most commonly used when an application uses a single OracleBulkCopy
instance to process more than one bulk copy operation. If column mappings are created for one bulk copy operation, the OracleBulkCopyColumnMappingCollection
must be cleared after the WriteToServer
method invocation and before the next bulk copy is processed.
It is usually more efficient to perform several bulk copies using the same OracleBulkCopy
instance than to use a separate OracleBulkCopy
for each operation.
This method returns a value indicating whether or not a specified OracleBulkCopyColumnMapping
object exists in the collection.
// C#
public bool Contains(OracleBulkCopyColumnMapping value);
value
A valid OracleBulkCopyColumnMapping
object.
Returns true
if the specified mapping exists in the collection; otherwise, returns false
.
This method copies the elements of the OracleBulkCopyColumnMappingCollection
to an array of OracleBulkCopyColumnMapping
items, starting at a specified index.
// C# public void CopyTo(OracleBulkCopyColumnMapping[] array, int index);
array
The one-dimensional OracleBulkCopyColumnMapping
array that is the destination for the elements copied from the OracleBulkCopyColumnMappingCollection
object. The array must have zero-based indexing.
index
The zero-based array index at which copying begins.
This method returns the index of the specified OracleBulkCopyColumnMapping
object.
// C#
public int IndexOf(OracleBulkCopyColumnMapping value);
value
The OracleBulkCopyColumnMapping
object that is being returned.
The zero-based index of the column mapping or -1 if the column mapping is not found in the collection.
This method inserts a new OracleBulkCopyColumnMapping
object in the collection, at the index specified.
// C# public void Insert(int index, OracleBulkCopyColumnMapping value);
index
The integer value of the location within the OracleBulkCopyColumnMappingCollection
at which the new OracleBulkCopyColumnMapping
is inserted.
value
The OracleBulkCopyColumnMapping
object to be inserted in the collection.
InvalidOperationException
- The bulk copy operation is in progress.
This method removes the specified OracleBulkCopyColumnMapping
element from the OracleBulkCopyColumnMappingCollection
.
// C#
public void Remove(OracleBulkCopyColumnMapping value);
value
The OracleBulkCopyColumnMapping
object to be removed from the collection.
InvalidOperationException
- The bulk copy operation is in progress.
The Remove
method is most commonly used when a single OracleBulkCopy
instance processes more than one bulk copy operation. If column mappings are created for one bulk copy operation, mappings that no longer apply must be removed after the WriteToServer
method invocation and before mappings are defined for the next bulk copy. The Clear
method can clear the entire collection, and the Remove
and the RemoveAt
methods can remove mappings individually.
It is usually more efficient to perform several bulk copies using the same OracleBulkCopy
instance than to use a separate OracleBulkCopy
for each operation.
This method removes the mapping from the collection at the specified index.
// C#
public void RemoveAt(int index);
index
The zero-based index of the OracleBulkCopyColumnMapping
object to be removed from the collection.
InvalidOperationException
- The bulk copy operation is in progress.
The RemoveAt
method is most commonly used when a single OracleBulkCopy
instance is used to process more than one bulk copy operation. If column mappings are created for one bulk copy operation, mappings that no longer apply must be removed after the WriteToServer
method invocation and before the mappings for the next bulk copy are defined. The Clear
method can clear the entire collection, and the Remove
and the RemoveAt
methods can remove mappings individually.
It is usually more efficient to perform several bulk copies using the same OracleBulkCopy
instance than to use a separate OracleBulkCopy
for each operation.