Link Search Menu Expand Document

SapHanaBulkInsertMapItem


This class extends BulkInsertMapItem with an optional, explicit HanaDbType to bind with for the mapped column.

Used by the SAP HANA BulkInsert, BulkMerge and BulkUpdate operations. Mappings are also type-checked: if a mapping’s source and destination CLR types are incompatible (other than the allowed Guidstring and integral-to-integral widenings), the write throws an InvalidTypeException up front rather than failing inside SAP HANA.

Create a new Instance

var mapItem = new SapHanaBulkInsertMapItem("SourceId", "DestinationId");

Or with an explicit HanaDbType:

var mapItem = new SapHanaBulkInsertMapItem("SourceName", "DestinationName", HanaDbType.NVarChar);

Usage for BulkOperations

var mappings = new []
{
    new SapHanaBulkInsertMapItem("FirstName", "FName"),
    new SapHanaBulkInsertMapItem("LastName", "LName")
};

using (var connection = new HanaConnection(connectionString))
{
    var people = GetPeople(100000);
    connection.BulkInsert(people, mappings: mappings);
}

The same approach applies to BulkMerge and BulkUpdate. The mappings argument is optional — omitting it causes the library to auto-map columns by name (case-insensitive).