EF Core: choosing between BulkMerge and manual SQL upserts
woodruff.dev
EF Core has no native upsert operation. This article compares manual processing, SQL Server MERGE, and BulkMerge for inserting or updating batches, including parent-child graphs. It lays out the trade-offs in dependencies, portability, and maintenance, alongside benchmarks tied to their test environment.
With BulkMerge, the match key is critical: without an explicit business key, incoming records can be treated as new rows. Column-selection options can also preserve manually curated fields, while IncludeGraph propagates foreign keys from parents to children.
