AuroraDbBulkInsertMapItem
A mapping class used to define a column mapping, with an optional explicit AuroraDbType, for the Aurora PostgreSQL bulk operations.
This class extends BulkInsertMapItem with an optional, explicit RepoDb.Connector.AuroraDb.Npgsql.AuroraDbType to bind with for the mapped column. When not provided, the type is inferred from the entity property’s [AuroraDbType] attribute (if present) or, failing that, from the .NET CLR value itself.
Used by the Aurora PostgreSQL BulkInsert, BulkMerge and BulkUpdate operations. Mappings are also type-checked up front: if a mapping’s source and destination CLR types are incompatible (other than the allowed Guid↔string and integral-to-integral widenings), the write throws an InvalidTypeException before anything is sent to Aurora PostgreSQL.
Create a new Instance
var mapItem = new AuroraDbBulkInsertMapItem("SourceId", "DestinationId");
Or with an explicit AuroraDbType:
var mapItem = new AuroraDbBulkInsertMapItem("SourceName", "DestinationName", AuroraDbType.Text);
Usage for BulkOperations
var mappings = new []
{
new AuroraDbBulkInsertMapItem("FirstName", "FName"),
new AuroraDbBulkInsertMapItem("LastName", "LName")
};
using (var connection = new AuroraDbConnection(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).