SapHanaBulkDbSetting

A setting class used to control the write strategy and the column-mappings behavior of the SAP HANA bulk operations.

This class extends SapHanaDbSetting and implements ISapHanaBulkDbSetting with a WriteToServerExecution property that controls how the Async overloads of the RepoDb.SapHana.BulkOperations operations write rows to the server, and a BulkColumnMappingsBehavior property that controls how a bulk operation aligns the columns of the source with the columns of the destination table when no explicit mappings are passed.

Unlike SapHanaDbSetting, it is not registered automatically — SapHanaBootstrap maps the base SapHanaDbSetting by default. Register this class yourself only if you need to override the default write strategy.

Properties

Name Description
WriteToServerExecution A SapHanaWriteToServerExecution value that controls how the bulk operations’ Async overloads write rows to the server. Defaults to AsyncOverSync, which offloads the real HanaBulkCopy load onto a background thread; SapHanaCommandBatcher (SapHanaCommandBatcher) is an opt-in, much slower, row-by-row fallback.
BulkColumnMappingsBehavior Gets or sets the SapHanaBulkColumnMappingsBehavior value that defines how the columns of the source are aligned with the columns of the destination table when no explicit mappings were passed to a bulk operation. Explicit mappings always take precedence over this setting. The default value is Automatic.

Usability

Pass an instance directly to UseSapHana() in place of the default settings object. To fall back to the row-by-row batcher instead of the default AsyncOverSync:

GlobalConfiguration
    .Setup()
    .UseSapHana(new SapHanaBulkDbSetting { WriteToServerExecution = SapHanaWriteToServerExecution.SapHanaCommandBatcher });

Or opt into fail-fast column-mappings validation:

GlobalConfiguration
    .Setup()
    .UseSapHana(new SapHanaBulkDbSetting
    {
        BulkColumnMappingsBehavior = SapHanaBulkColumnMappingsBehavior.Strict
    });

Or register it after the fact via DbSettingMapper.

DbSettingMapper.Add<HanaConnection>(
    new SapHanaBulkDbSetting { WriteToServerExecution = SapHanaWriteToServerExecution.SapHanaCommandBatcher },
    true);

This requires RepoDb.SapHana.BulkOperations to be installed, since that’s where this class lives.