Db2BulkInsertMapItem
This class extends BulkInsertMapItem with an optional, explicit DB2Type to bind with for the mapped column. When not provided, the type is inferred from the entity property’s [DB2Type]/[Db2DbTypeEx] attribute (if present) or, failing that, from the .NET CLR value itself.
Used by the Db2 BulkInsert, BulkMerge and BulkUpdate operations.
Create a new Instance
var mapItem = new Db2BulkInsertMapItem("SourceId", "DestinationId");
Or with an explicit DB2Type:
var mapItem = new Db2BulkInsertMapItem("SourceName", "DestinationName", DB2Type.VarChar);
Usage for BulkOperations
var mappings = new []
{
new Db2BulkInsertMapItem("FirstName", "FName"),
new Db2BulkInsertMapItem("LastName", "LName"),
new Db2BulkInsertMapItem("Age", "Age", DB2Type.Integer)
};
using (var connection = new DB2Connection(connectionString))
{
var people = GetPeople(100000);
connection.BulkInsert(people, mappings: mappings);
}
The same approach applies to BulkMerge and BulkUpdate. The
mappingsargument is optional — omitting it causes the library to auto-map columns by name (case-insensitive).