FlexLabs.EntityFrameworkCore.Upsert
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package FlexLabs.EntityFrameworkCore.Upsert --version 1.0.0
NuGet\Install-Package FlexLabs.EntityFrameworkCore.Upsert -Version 1.0.0
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="1.0.0" />
paket add FlexLabs.EntityFrameworkCore.Upsert --version 1.0.0
#r "nuget: FlexLabs.EntityFrameworkCore.Upsert, 1.0.0"
// Install FlexLabs.EntityFrameworkCore.Upsert as a Cake Addin #addin nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=1.0.0 // Install FlexLabs.EntityFrameworkCore.Upsert as a Cake Tool #tool nuget:?package=FlexLabs.EntityFrameworkCore.Upsert&version=1.0.0
In it's simplest form, it can be used as follows:
DataContext.Upsert(new Country
{
Name = "Australia",
ISO = "AU",
})
.On(c => c.ISO)
.RunAsync();
The first parameter will be used to insert new entries to the table, the second one is used to identify the columns used to find matching rows.
If the entry already exists, the command will update the remaining columns to match the entity passed in the first argument.
In some cases, you don't want ALL the entities to be changed. An example field that you wouldn't want updated is the Created
field. You can use a third parameter to select which columns and values to set in case the entity already exists:
DataContext.Upsert(new Country
{
Name = "Australia",
ISO = "AU",
Created = DateTime.UtcNow,
})
.On(c => c.ISO)
.UpdateColumns(c => new Country
{
Name = "Australia"
Updated = DateTime.UtcNow,
})
.RunAsync();
Finally, sometimes you might want to update a column based on the current value in the table. For example, if you want to increment a column. You can use the following syntax (basic support for incrementing and decrementing values is currently implemented):
You can also see how to implement the multi column record matching:
DataContext.Upsert(new DailyVisits
{
UserID = userID,
Date = DateTime.UtcNow.Date,
Visits = 1,
})
.On(v => new { v.UserID, v.Date })
.UpdateColumns(v => new DailyVisits
{
Visits = v.Visits + 1,
})
.RunAsync();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- Microsoft.EntityFrameworkCore.Relational (>= 2.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. |
|
YYApp
YYApp Core |
|
QuantFi.Services
Package Description |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on FlexLabs.EntityFrameworkCore.Upsert:
Repository | Stars |
---|---|
zoriya/Kyoo
A portable and vast media library solution.
|
|
Texnomic/SecureDNS
Secure, Modern, Fully-Featured, All-In-One Cross-Architecture & Cross-Platform DNS Server Using .NET 8.0
|
|
PlexRipper/PlexRipper
A cross-platform Plex media downloader that seamlessly adds media from other Plex servers to your own!
|
|
Kukks/NNostr
A Nostr Relay and Client written in C#
|
Version | Downloads | Last updated | |
---|---|---|---|
8.1.2 | 21,476 | 11/28/2024 | |
8.1.0 | 5,443 | 11/24/2024 | |
8.0.0 | 1,036,266 | 12/3/2023 | |
7.0.0 | 939,825 | 12/18/2022 | |
7.0.0-beta.2 | 6,236 | 11/22/2022 | |
7.0.0-beta.1 | 441 | 11/16/2022 | |
6.0.2 | 471,956 | 11/16/2022 | |
6.0.1 | 3,886,875 | 1/2/2022 | |
6.0.0-preview5 | 57,491 | 7/11/2021 | |
5.1.0 | 67,081 | 1/2/2022 | |
5.0.0 | 366,457 | 7/11/2021 | |
4.0.1 | 34,369 | 7/11/2021 | |
4.0.0 | 379,574 | 3/2/2021 | |
3.1.0 | 2,190,449 | 1/26/2020 | |
3.0.0 | 107,040 | 9/29/2019 | |
3.0.0-netcore3-00140 | 3,659 | 8/11/2019 | |
2.2.1 | 109,215 | 9/17/2019 | |
2.2.0 | 43,825 | 8/11/2019 | |
2.1.2 | 88,496 | 5/22/2019 | |
2.1.1 | 2,369 | 5/21/2019 | |
2.1.0 | 2,909 | 5/19/2019 | |
2.0.7 | 54,184 | 3/18/2019 | |
2.0.6 | 11,351 | 2/6/2019 | |
2.0.5 | 17,653 | 1/25/2019 | |
2.0.4 | 8,743 | 1/3/2019 | |
2.0.3 | 7,194 | 12/18/2018 | |
2.0.2 | 12,168 | 11/3/2018 | |
2.0.1 | 2,709 | 10/24/2018 | |
2.0.0 | 11,250 | 9/19/2018 | |
1.1.0 | 2,309 | 9/19/2018 | |
1.0.4 | 14,125 | 3/10/2018 | |
1.0.3 | 2,497 | 2/23/2018 | |
1.0.2 | 2,311 | 2/20/2018 | |
1.0.1 | 2,369 | 2/19/2018 | |
1.0.0 | 3,777 | 2/18/2018 |