DKNet.AspCore.Idempotency.Relational
10.1.10
dotnet add package DKNet.AspCore.Idempotency.Relational --version 10.1.10
NuGet\Install-Package DKNet.AspCore.Idempotency.Relational -Version 10.1.10
<PackageReference Include="DKNet.AspCore.Idempotency.Relational" Version="10.1.10" />
<PackageVersion Include="DKNet.AspCore.Idempotency.Relational" Version="10.1.10" />
<PackageReference Include="DKNet.AspCore.Idempotency.Relational" />
paket add DKNet.AspCore.Idempotency.Relational --version 10.1.10
#r "nuget: DKNet.AspCore.Idempotency.Relational, 10.1.10"
#:package DKNet.AspCore.Idempotency.Relational@10.1.10
#addin nuget:?package=DKNet.AspCore.Idempotency.Relational&version=10.1.10
#tool nuget:?package=DKNet.AspCore.Idempotency.Relational&version=10.1.10
DKNet.AspCore.Idempotency.Relational
Shared Entity Framework Core base for building relational DKNet.AspCore.Idempotency stores — the entity, the
entity mapping, the shared DbContext, and the concurrency-safe insert-or-query pattern that
DKNet.AspCore.Idempotency.MsSqlStore and DKNet.AspCore.Idempotency.NpgsqlStore both derive from.
This is an internal base package, not something app authors register directly. If you are adding idempotency to an app, install
DKNet.AspCore.Idempotencyplus a concrete provider package (.MsSqlStore/.NpgsqlStore) instead. Use this package only when implementing support for a new relational database.
Features
- Shared
IdempotencyKeyEntityandIEntityTypeConfiguration<IdempotencyKeyEntity>mapping every relational provider reuses as-is - Shared
IdempotencyDbContextbase with automatic discovery of the derived provider's own entity configuration - Race-safe insert-or-query reservation pattern (
IdempotencyRelationalStore<TContext>) backed by a unique-index guarantee, including atomic reclaim of expired reservations - Per-connection-string migration guard so a process serving multiple databases migrates each one exactly once
- Only two seams left to each provider: the response-body column type/check-constraint SQL, and how to recognize that provider's own unique-key-violation error
Installation
dotnet add package DKNet.AspCore.Idempotency.Relational
Quick Start — implementing a new provider store
A new relational provider derives four types from this package:
// 1. Closed DbContext
internal sealed class IdempotencyDbContext(DbContextOptions<IdempotencyDbContext> options)
: DKNet.AspCore.Idempotency.Relational.Data.IdempotencyDbContext(options);
// 2. Provider-specific mapping details
internal sealed class IdempotencyKeyConfiguration
: DKNet.AspCore.Idempotency.Relational.Data.Configurations.IdempotencyKeyConfiguration
{
protected override string BodyColumnType => "text";
protected override string StatusCodeCheckConstraintSql => "\"StatusCode\" BETWEEN 100 AND 599";
}
// 3. Provider-specific unique-violation detection
internal sealed class IdempotencyPostgresStore(
IServiceProvider serviceProvider, IOptions<IdempotencyOptions> options, ILogger<IdempotencyPostgresStore> logger)
: IdempotencyRelationalStore<IdempotencyDbContext>(serviceProvider, options, logger)
{
protected override bool IsProviderUniqueViolation(DbUpdateException ex) =>
ex.InnerException is PostgresException { SqlState: PostgresErrorCodes.UniqueViolation };
}
// 4. DI wiring (own project's setup extension)
services.AddDbContext<IdempotencyDbContext>(o => o.UseNpgsql(connectionString))
.AddDbContextFactory<IdempotencyDbContext>();
services.AddIdempotentKey<IdempotencyPostgresStore>();
Because the base types here are internal, the new provider project must be added to this package's
InternalsVisibleTo list.
Requirements
- .NET 10.0+
Microsoft.EntityFrameworkCore/Microsoft.EntityFrameworkCore.Relational- DKNet.AspCore.Idempotency (automatically included)
Full documentation
See DKNet.AspCore.Idempotency.Relational for the full feature breakdown, mapping defaults, and gotchas.
License
This project is licensed under the MIT License - see the LICENSE file for details.
About
Developed by Steven Hoang.
| 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
- DKNet.AspCore.Idempotency (>= 10.1.10)
- Microsoft.EntityFrameworkCore (>= 10.0.11)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.11)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on DKNet.AspCore.Idempotency.Relational:
| Package | Downloads |
|---|---|
|
DKNet.AspCore.Idempotency.MsSqlStore
DKNet is an enterprise-grade .NET library collection focused on advanced EF Core extensions, dynamic predicate building, and the Specification pattern. It provides production-ready tools for building robust, type-safe, and testable data access layers, including dynamic LINQ support, LinqKit integration. Designed for modern cloud-native applications, DKNet enforces strict code quality, async best practices, and full documentation for all public APIs. Enterprise-grade .NET library suite for modern application development, featuring advanced EF Core extensions (dynamic predicates, specifications, LinqKit), robust Domain-Driven Design (DDD) patterns, and domain event support. DKNet empowers scalable, maintainable, and testable solutions with type-safe validation, async/await, XML documentation, and high code quality standards. Ideal for cloud-native, microservices, and enterprise architectures. |
|
|
DKNet.AspCore.Idempotency.NpgsqlStore
DKNet is an enterprise-grade .NET library collection focused on advanced EF Core extensions, dynamic predicate building, and the Specification pattern. It provides production-ready tools for building robust, type-safe, and testable data access layers, including dynamic LINQ support, LinqKit integration. Designed for modern cloud-native applications, DKNet enforces strict code quality, async best practices, and full documentation for all public APIs. Enterprise-grade .NET library suite for modern application development, featuring advanced EF Core extensions (dynamic predicates, specifications, LinqKit), robust Domain-Driven Design (DDD) patterns, and domain event support. DKNet empowers scalable, maintainable, and testable solutions with type-safe validation, async/await, XML documentation, and high code quality standards. Ideal for cloud-native, microservices, and enterprise architectures. |
GitHub repositories
This package is not used by any popular GitHub repositories.