Part of DKNet.AspCore.Idempotency.NpgsqlStore. IdempotencyNpgsqlSetup provides two application entry points:
using DKNet.AspCore.Idempotency.NpgsqlStore;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddLogging();
var connection = Environment.GetEnvironmentVariable("ConnectionStrings__Idempotency")
?? throw new InvalidOperationException("Set ConnectionStrings__Idempotency.");
services.AddIdempotencyWithNpgsqlStore(connection);
| Method | Registers |
|---|---|
AddIdempotencyNpgsqlStore(string) |
Provider context, context factory, and startup migration service only. |
AddIdempotencyWithNpgsqlStore(string, Action<IdempotencyOptions>?) |
The infrastructure above, plus the internal IdempotencyPostgresStore as singleton IIdempotencyKeyStore. |
The context is scoped, its options and factory are singleton, and each store operation creates its own context. The lower-level registration returns unchanged if its provider context is already registered; the first connection string therefore remains selected. Core store selection separately keeps the first explicit store, while allowing replacement of the in-memory default.
| Input | Type | Default | Effect |
|---|---|---|---|
connectionString |
string |
required | Database used for provider-owned migrations and ledger rows. |
config |
Action<IdempotencyOptions>? |
null | Configures core validation, scope, and retention. |
There is no provider-specific options class. CachePrefix does not isolate relational rows.
The package overview shows the host registrations and dependencies behind this capability. The core filter and selected store have separate responsibilities.
IdempotencyPostgresStore and its context are internal; use the public extension methods.