<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn" -->

---
title: BulkMerge (Upsert) in EF Core: How to Insert-or-Update...
description: EF Core 10 still lacks a native upsert primitive, leaving developers to choose between a slow manual check-then-write loop, raw T-SQL MERGE with table-valued...
canonical: https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: BulkMerge (Upsert) in EF Core: How to Insert-or-Update Without the Headache - Chris Woody Woodruff | daily.dev
og:description: EF Core 10 still lacks a native upsert primitive, leaving developers to choose between a slow manual check-then-write loop, raw T-SQL MERGE with table-valued...
og:url: https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn
og:image: https://api.daily.dev/og/posts/hAUz7OJwN.png
og:image:alt: BulkMerge (Upsert) in EF Core: How to Insert-or-Update Without the Headache - Chris Woody Woodruff
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# BulkMerge (Upsert) in EF Core: How to Insert-or-Update Without the Headache - Chris Woody Woodruff

**[We Are .NET](https://daily.dev/sources/wearedotnet)** · 21 min read · 2 upvotes · 0 comments

## Summary

EF Core 10 still lacks a native upsert primitive, leaving developers to choose between a slow manual check-then-write loop, raw T-SQL MERGE with table-valued parameters, or Entity Framework Extensions' BulkMerge. The manual approach issues one SELECT per record and collapses at scale (50K rows takes ~2 seconds). Raw T-SQL MERGE with TVPs is fast and free but SQL Server-only and schema-coupled. EFE's BulkMerge handles flat and parent-child graph upserts across all major providers, with business key matching via ColumnPrimaryKeyExpression, per-phase column control via OnMergeUpdateInputExpression, and graph traversal via IncludeGraph. Key caveats: always set a business key match expression (default identity matching silently inserts duplicates), BulkMerge bypasses EF Core interceptors, and BulkSynchronize deletes unmatched rows — don't confuse the two. Benchmarks show BulkMerge and raw MERGE TVP are comparable on flat upserts, while IncludeGraph outperforms manual multi-pass for graph scenarios. EFCore.BulkExtensions (borisdj) is a credible free alternative for simpler flat upsert cases. Note: the post is sponsored by ZZZ Projects, the maker of EFE.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://woodruff.dev/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache>

## Similar posts on daily.dev

- [BulkSynchronize in EF Core: Mirror Your Data in One Operation - Chris Woody Woodruff](https://daily.dev/posts/bulksynchronize-in-ef-core-mirror-your-data-in-one-operation---chris-woody-woodruff-nhbxuoyw8) · We Are .NET · 1 upvotes · 0 comments
- [Insane Performance Boost in EF Core using Entity Framework Extensions](https://daily.dev/posts/insane-performance-boost-in-ef-core-using-entity-framework-extensions-r3pbiriw6) · We Are .NET · 4 upvotes · 0 comments
- [EF Core Bulk Insert: The Complete Guide to Inserting Thousands of Rows Without the Wait - Chris Woody Woodruff](https://daily.dev/posts/ef-core-bulk-insert-the-complete-guide-to-inserting-thousands-of-rows-without-the-wait---chris-wood-y8ogyumi6) · We Are .NET · 0 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"BulkMerge (Upsert) in EF Core: How to Insert-or-Update Without the Headache - Chris Woody Woodruff","url":"https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn"},"datePublished":"2026-06-18T19:10:54.327Z","dateModified":"2026-06-18T19:11:22.411Z","description":"EF Core 10 still lacks a native upsert primitive, leaving developers to choose between a slow manual check-then-write loop, raw T-SQL MERGE with table-valued...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9e849242068eb9f0645d0e7b17d5aed4?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9e849242068eb9f0645d0e7b17d5aed4?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"We Are .NET","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"We Are .NET","logo":"https://media.daily.dev/image/upload/s--BsnVOa3i--/f_auto/v1718347410/logos/wearedotnet","url":"https://daily.dev/sources/wearedotnet"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/bulkmerge-upsert-in-ef-core-how-to-insert-or-update-without-the-headache---chris-woody-woodruff-hauz7ojwn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,c#,microsoft-sql-server","timeRequired":"PT21M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"We Are .NET","item":"https://daily.dev/sources/wearedotnet"},{"@type":"ListItem","position":3,"name":"BulkMerge (Upsert) in EF Core: How to Insert-or-Update Without the Headache - Chris Woody Woodruff"}]}
```

