SapHanaBulkColumnMappingsBehavior
An enumeration that is being used to define how a bulk operation aligns the columns of the source with the columns of the destination table.
This enum defines how a bulk operation (BulkInsert, BulkMerge, BulkUpdate and BulkDelete) aligns the columns of the source (entities, DataTable or DbDataReader) with the columns of the destination table, when no explicit mappings argument was passed to the operation — an explicit mappings argument always takes precedence over this setting. It applies only to RepoDb.SapHana.BulkOperations.
Enum Values
| Name | Description |
|---|---|
| Automatic | Only the columns that exist on both the source and the destination table (matched by name) are mapped; all other columns are ignored on either side, and column order does not matter. This is the default value, and preserves the library’s pre-existing behavior. |
| Strict | The columns of the source must be identical to the columns of the destination table in both name and order. Any difference — a missing column on either side, or a different order — throws a SapHanaBulkColumnMappingsException before any data is written. |
| StrictBypass | Every column of the source must exist on the destination table (matched by name), but column order does not matter. Destination columns not supplied by the source are bypassed (left to their default, identity or computed values). A source column that does not exist on the destination table throws a SapHanaBulkColumnMappingsException before any data is written, so no source data is ever silently dropped. |
Usability
Set this via the SapHanaBulkDbSetting class and register it through SapHanaConfiguration — the behavior then applies to every bulk operation call on this provider’s connections that passes no explicit mappings.
GlobalConfiguration
.Setup()
.UseSapHana(new SapHanaBulkDbSetting
{
BulkColumnMappingsBehavior = SapHanaBulkColumnMappingsBehavior.Strict
});
StrictandStrictBypassboth throw aSapHanaBulkColumnMappingsException(naming every offending column) before any data is written, so no source data is ever silently dropped due to a typo’d or missing column name.