FlexLabs.EntityFrameworkCore.Upsert
10.0.0
Prefix Reserved
dotnet add package FlexLabs.EntityFrameworkCore.Upsert --version 10.0.0
NuGet\Install-Package FlexLabs.EntityFrameworkCore.Upsert -Version 10.0.0
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="10.0.0" />
<PackageVersion Include="FlexLabs.EntityFrameworkCore.Upsert" Version="10.0.0" />
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" />
paket add FlexLabs.EntityFrameworkCore.Upsert --version 10.0.0
#r "nuget: FlexLabs.EntityFrameworkCore.Upsert, 10.0.0"
#:package FlexLabs.EntityFrameworkCore.Upsert@10.0.0
#addin nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=10.0.0
#tool nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=10.0.0
FlexLabs.Upsert
This library adds basic support for "Upsert" operations to EF Core.
Uses INSERT … ON CONFLICT DO UPDATE in PostgreSQL/Sqlite, MERGE in SqlServer & Oracle and INSERT INTO … ON DUPLICATE KEY UPDATE in MySQL.
Also supports injecting sql command runners to add support for other providers
A typical upsert command could look something like this:
DataContext.DailyVisits
.Upsert(new DailyVisit
{
UserID = userID,
Date = DateTime.UtcNow.Date,
Visits = 1,
})
.On(v => new { v.UserID, v.Date })
.WhenMatched(v => new DailyVisit
{
Visits = v.Visits + 1,
})
.RunAsync();
In this case, the upsert command will ensure that a new DailyVisit will be added to the database. If a visit with the same UserID and Date already exists, it will be updated by incrementing it's Visits value by 1.
Please read our Usage page for more examples
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.0 && < 11.0.0)
NuGet packages (16)
Showing the top 5 NuGet packages that depend on FlexLabs.EntityFrameworkCore.Upsert:
| Package | Downloads |
|---|---|
|
FenixAlliance.ACL.Dependencies
Application Component for the Alliance Business Suite. |
|
|
TickerQ.EntityFrameworkCore
Entity Framework Core integration for scheduling and persisting cron/time-based jobs using TickerQ. |
|
|
HwApp.Core
HwApp Core |
|
|
Elsa.Persistence.EntityFrameworkCore
Elsa is a set of workflow libraries and tools that enable super-fast workflowing capabilities in any .NET Core application. This package provides an Entity Framework Core persistence provider. |
|
|
QuantFi.Services
Package Description |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on FlexLabs.EntityFrameworkCore.Upsert:
| Repository | Stars |
|---|---|
|
Reaparr/Reaparr
Plex downloader that brings content from any server to yours!
|
|
|
Texnomic/SecureDNS
Secure, Modern, Fully-Featured, All-In-One Cross-Architecture & Cross-Platform DNS Server Using .NET 10
|
|
|
Kukks/NNostr
A Nostr Relay and Client written in C#
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 10.0.0 | 81,096 | 2/26/2026 | |
| 10.0.0-rc1 | 21,963 | 2/3/2026 | |
| 10.0.0-beta2 | 42,214 | 12/23/2025 | |
| 10.0.0-beta1 | 189,551 | 11/5/2025 | |
| 9.103.0 | 40,333 | 1/21/2026 | |
| 9.102.0 | 14,341 | 12/23/2025 | |
| 9.101.0 | 77,725 | 11/4/2025 | |
| 9.100.1 | 110,603 | 9/17/2025 | |
| 9.100.0 | 59,188 | 8/30/2025 | |
| 9.0.0 | 501,993 | 3/3/2025 | |
| 8.1.2 | 953,662 | 11/28/2024 | |
| 8.1.0 | 32,284 | 11/24/2024 | |
| 8.0.0 | 2,524,751 | 12/3/2023 | |
| 7.0.0 | 1,232,690 | 12/18/2022 | |
| 7.0.0-beta.2 | 6,810 | 11/22/2022 | |
| 7.0.0-beta.1 | 586 | 11/16/2022 | |
| 6.0.2 | 640,725 | 11/16/2022 | |
| 6.0.1 | 5,205,438 | 1/2/2022 | |
| 5.1.0 | 71,918 | 1/2/2022 |
v10.0.0
+ Adding support for EF Core 10
v9.102.0
! Fix type mapping for ulong constants (Thanks to @ahmednfwela)
! Fix RunAndReturn methods returning stale tracked entity values (Thanks to @sdukehart-omnesoft)
v9.101.0
! Patching implicit conversions not being supported after last update (Thanks to @fortender)
! Patching query filters preventing from retrieving upserted entities (Thanks to @Lexiphan)
v9.100.0
+ Significant internal upgrade with a new expression parser (Thanks to @r-Larch)
+ Adding support for owned entities and owned JSON entities (Thanks to @r-Larch)
+ Adding option to exclude columns on auto-updates (Thanks to @B3RR10)
v9.0.0
+ Adding support for EF Core 9
v8.1.0
+ Adding initial support for Oracle DB! (Thanks to @dadyarri)
+ Adding test support for returning inserted objects (Thanks to @PhenX)
+ Adding support for upserting into views (ymmv)
! Patching argument count calculation (for max argument count handling)
! Patching null constant handling in the update condition
v8.0.0
+ Adding support for EF Core 8