EDBBulkImportIdentityBehavior
This enum defines the behavior of the identity property/column when an entity is bulk-imported into a target table. It applies only to EnterpriseDB.
Enum Values
| Name | Description |
|---|---|
| KeepIdentity | The value of the identity property/column will be kept and used. (This is the default value) |
| ReturnIdentity | The newly generated identity value from the target table will be set back to the entity. |
Usability
This enum is used by both the BulkInsert and BulkMerge operations of RepoDb.EnterpriseDb.BulkOperations. Pass the value to the identityBehavior argument when calling the operation.
For BulkInsert:
using (var connection = new EDBConnection(connectionString))
{
var people = GetPeople(1000);
var insertedRows = connection.BulkInsert(people,
identityBehavior: EDBBulkImportIdentityBehavior.ReturnIdentity);
}
For BulkMerge:
using (var connection = new EDBConnection(connectionString))
{
var people = GetPeople(1000);
var mergedRows = connection.BulkMerge(people,
identityBehavior: EDBBulkImportIdentityBehavior.ReturnIdentity);
}
The
DbDataReaderoverloads of BulkInsert and BulkMerge have noidentityBehaviorargument — a forward-only, single-pass reader cannot be rewound to correlate generated identity values back onto a source row.