MERGE all entities from the database.
A merge is an
UPSERT operation. All rows that match the entity key are considered as existing and are
UPDATED, other rows are considered as new rows and are
INSERTED in the database.
Merging entities using a custom key from file importation is a typical scenario.
ChangeTracker being outstanding to track what’s modified, it lacks in term of scalability and flexibility.
SubmitChanges requires one database round-trip for every entity to
update. So if you need to
update 10000 entities, then 10000 database round-trips will be performed which is INSANELY slow.
BulkMerge in counterpart offers great customization and requires the minimum database round-trips as possible.
|Operations||1,000 Entities||2,000 Entities||5,000 Entities|
|SubmitChanges||1,000 ms||2,000 ms||5,000 ms|
|BulkMerge||65 ms||80 ms||110 ms|
You can specify more than one option using anonymous block.
You can specify a custom batch size using the
Read more: BatchSize
You can specify custom columns using the
Read more: ColumnInputExpression
You can specify custom columns to exclude using the
Read more: IgnoreOnMergeInsertExpression
Read more: IgnoreOnMergeUpdateExpression
You can specify custom keys using the
Read more: ColumnPrimaryKeyExpression
To provide the best performance possible!
Since using the
ChangeTracker can greatly reduce performance, we chose to let
SubmitChanges method handle scenarios with
BulkMerge, scenarios without it.