FlexLabs.EntityFrameworkCore.Upsert
9.0.0
Prefix Reserved
dotnet add package FlexLabs.EntityFrameworkCore.Upsert --version 9.0.0
NuGet\Install-Package FlexLabs.EntityFrameworkCore.Upsert -Version 9.0.0
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="9.0.0" />
<PackageVersion Include="FlexLabs.EntityFrameworkCore.Upsert" Version="9.0.0" />
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" />
paket add FlexLabs.EntityFrameworkCore.Upsert --version 9.0.0
#r "nuget: FlexLabs.EntityFrameworkCore.Upsert, 9.0.0"
#:package FlexLabs.EntityFrameworkCore.Upsert@9.0.0
#addin nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=9.0.0
#tool nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=9.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 | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.0 && < 10.0.0)
NuGet packages (14)
Showing the top 5 NuGet packages that depend on FlexLabs.EntityFrameworkCore.Upsert:
Package | Downloads |
---|---|
FenixAlliance.ACL.Dependencies
Application Component for the Alliance Business Suite. |
|
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 |
|
YYApp
YYApp Core |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on FlexLabs.EntityFrameworkCore.Upsert:
Repository | Stars |
---|---|
PlexRipper/PlexRipper
A cross-platform Plex media downloader that seamlessly adds media from other Plex servers to your own!
|
|
Texnomic/SecureDNS
Secure, Modern, Fully-Featured, All-In-One Cross-Architecture & Cross-Platform DNS Server Using .NET 8.0
|
|
Kukks/NNostr
A Nostr Relay and Client written in C#
|
Version | Downloads | Last Updated | |
---|---|---|---|
9.0.0 | 147,507 | 5 months ago | |
8.1.2 | 377,887 | 8 months ago | |
8.1.0 | 16,375 | 8 months ago | |
8.0.0 | 1,696,541 | 12/3/2023 | |
7.0.0 | 1,059,257 | 12/18/2022 | |
7.0.0-beta.2 | 6,345 | 11/22/2022 | |
7.0.0-beta.1 | 488 | 11/16/2022 | |
6.0.2 | 552,975 | 11/16/2022 | |
6.0.1 | 4,485,467 | 1/2/2022 | |
6.0.0-preview5 | 58,363 | 7/11/2021 | |
5.1.0 | 68,999 | 1/2/2022 | |
5.0.0 | 375,680 | 7/11/2021 | |
4.0.1 | 39,400 | 7/11/2021 | |
4.0.0 | 384,362 | 3/2/2021 | |
3.1.0 | 2,390,809 | 1/26/2020 | |
3.0.0 | 108,669 | 9/29/2019 | |
3.0.0-netcore3-00140 | 3,743 | 8/11/2019 | |
2.2.1 | 111,287 | 9/17/2019 | |
2.2.0 | 44,524 | 8/11/2019 | |
2.1.2 | 91,823 | 5/22/2019 | |
2.1.1 | 2,463 | 5/21/2019 | |
2.1.0 | 3,018 | 5/19/2019 | |
2.0.7 | 54,333 | 3/18/2019 | |
2.0.6 | 11,454 | 2/6/2019 | |
2.0.5 | 17,769 | 1/25/2019 | |
2.0.4 | 8,843 | 1/3/2019 | |
2.0.3 | 7,307 | 12/18/2018 | |
2.0.2 | 12,416 | 11/3/2018 | |
2.0.1 | 2,825 | 10/24/2018 | |
2.0.0 | 11,415 | 9/19/2018 | |
1.1.0 | 2,426 | 9/19/2018 | |
1.0.4 | 14,466 | 3/10/2018 | |
1.0.3 | 2,787 | 2/23/2018 | |
1.0.2 | 2,528 | 2/20/2018 | |
1.0.1 | 2,661 | 2/19/2018 | |
1.0.0 | 7,516 | 2/18/2018 |
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
v7.0.0
+ Adding support for EF Core 7
v6.0.2
* Improving entity type detection when using DbSet<>
! Patching MySQL handling of null columns
v6.0.0
+ Adding support for EF Core 6
+ Handling UseIdentityAlwaysColumn columns
v5.0.0
! Fixing the library versioning. From now one, one version of the library depends on one version of EF Core, for all supported target frameworks
v4.0.1
! Patching some MySql conditional update queries
v4.0.0
+ Adding support for .NET 5 and EF Core 5
! Patched support for constants in the update condition
! Run and RunAsync will not return all rows affected when command was split into multiple batches, not just the last batch's row count
! Patching the extension method to replace/inject custom command runner
! Removed old extension method on IServiceCollection, since it wasn't working anyway