Pandatech.EFCore.PostgresExtensions
1.0.0
See the version list below for details.
dotnet add package Pandatech.EFCore.PostgresExtensions --version 1.0.0
NuGet\Install-Package Pandatech.EFCore.PostgresExtensions -Version 1.0.0
<PackageReference Include="Pandatech.EFCore.PostgresExtensions" Version="1.0.0" />
paket add Pandatech.EFCore.PostgresExtensions --version 1.0.0
#r "nuget: Pandatech.EFCore.PostgresExtensions, 1.0.0"
// Install Pandatech.EFCore.PostgresExtensions as a Cake Addin #addin nuget:?package=Pandatech.EFCore.PostgresExtensions&version=1.0.0 // Install Pandatech.EFCore.PostgresExtensions as a Cake Tool #tool nuget:?package=Pandatech.EFCore.PostgresExtensions&version=1.0.0
Pandatech.EFCore.PostgresExtensions
Pandatech.EFCore.PostgresExtensions is a NuGet package that enhances Entity Framework Core with support for PostgreSQL-specific syntax for update operations.
Introduction
You can install the Pandatech.EFCore.PostgresExtensions NuGet package via the NuGet Package Manager UI or the Package Manager Console using the following command: Install-Package Pandatech.EFCore.PostgresExtensions
Features
Adds support for PostgreSQL-specific update syntax. Simplifies handling of update operations when working with PostgreSQL databases.
Installation
Install Pandatech.EFCore.PostgresExtensions Package
Install-Package Pandatech.EFCore.PostgresExtensions
Enable Query Locks
Inside the AddDbContext or AddDbContextPool method, after calling UseNpgsql(), call the UseQueryLocks() method on the DbContextOptionsBuilder to enable query locks.
services.AddDbContext<MyDbContext>(options =>
{
options.UseNpgsql(Configuration.GetConnectionString("MyDatabaseConnection"))
.UseQueryLocks();
});
Usage
Use the provided ForUpdate extension method on IQueryable within your application to apply PostgreSQL-specific update syntax.
using Pandatech.EFCore.PostgresExtensions;
using Microsoft.EntityFrameworkCore;
// Inside your service or repository method
using (var transaction = _dbContext.Database.BeginTransaction())
{
try
{
// Use the ForUpdate extension method on IQueryable inside the transaction scope
var entityToUpdate = _dbContext.Entities
.Where(e => e.Id == id)
.ForUpdate()
.FirstOrDefault();
// Perform updates on entityToUpdate
await _dbContext.SaveChangesAsync();
transaction.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
// Handle exception
}
}
License
Pandatech.EFCore.PostgresExtensions is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pandatech.EFCore.PostgresExtensions:
Package | Downloads |
---|---|
Pandatech.MassTransit.PostgresOutbox
Pandatech.MassTransit.PostgresOutbox extends MassTransit to offer advanced message handling capabilities for distributed systems. With first-class support for multiple DbContexts, this library integrates seamlessly with Entity Framework Core and PostgreSQL, providing reliable Outbox and Inbox patterns. It ensures consistent message delivery and processing in complex microservices architectures, leveraging PostgreSQL's ForUpdate feature to handle concurrency with ease. |
|
Pandatech.SharedKernel.Postgres
Pandatech.SharedKernel.Postgres simplifies PostgreSQL integration in ASP.NET Core applications by providing utilities for Entity Framework Core setup, health checks, and other enhancements. |
GitHub repositories
This package is not used by any popular GitHub repositories.
InitialCommit