ClickHouseBulkInsertMapItem
This class extends BulkInsertMapItem with an optional, explicit ClickHouse type name for the mapped column. When omitted, the type falls back to the entity property’s ClickHouseType attribute, or is otherwise inferred from the .NET CLR type.
Used by the ClickHouse BulkInsert, BulkMerge and BulkUpdate operations.
Create a new Instance
var mapItem = new ClickHouseBulkInsertMapItem("SourceId", "DestinationId");
Or with an explicit ClickHouse type name:
var mapItem = new ClickHouseBulkInsertMapItem("SourceCreatedDateUtc", "DestinationCreatedDateUtc", "Nullable(DateTime64(3))");
Usage for BulkOperations
var mappings = new []
{
new ClickHouseBulkInsertMapItem("FirstName", "FName"),
new ClickHouseBulkInsertMapItem("LastName", "LName"),
new ClickHouseBulkInsertMapItem("CreatedDateUtc", "CreatedDateUtc", "Nullable(DateTime64(3))")
};
using (var connection = new ClickHouseConnection(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.