EricksonLopez.Idempotency

dotnet-idempotency · Reliability & Concurrency

On this page (20 sections)

1. Identity, Tier & Maturity Profile#

L2 Cross-Cutting & ReliabilityStableMaintenance: ActiveAOT: FullMIT LicenseConfidence: HIGH
ApplicationInfrastructurenet8.0net9.0net10.0

2. Value Proposition & Problem Solved#

High-performance, Native AOT-first architectural idempotency engine, lease fencing, deterministic SHA-256 fingerprinting, and distributed consistency for modern .NET.

Network retries, client timeouts, and message redeliveries trigger duplicate side effects when endpoints or handlers lack atomic lease fencing and payload fingerprinting.

3. Quick Install#

Primary package: EricksonLopez.Idempotency

dotnet add package EricksonLopez.Idempotency --version 2.0.0
Also published in this family:
EricksonLopez.Idempotency.AbstractionsEricksonLopez.Idempotency.MySqlEricksonLopez.Idempotency.TestingEricksonLopez.Idempotency.MariaDbEricksonLopez.Idempotency.PostgreSqlEricksonLopez.Idempotency.Mediator

4. Verified Ecosystem Metrics#

v2.0.0
NuGet Published Version
v3.1.0
Repo HEAD Version
6,193
NuGet Downloads
13
Packable Packages
364
Public API Members
0
Benchmark Rows (RyuJIT)

Snapshot retrieved UTC: 2026-12-01

5. When to Use & When Not to Use#

When to use

  • You need HTTP or Mediator command idempotency with SHA-256 request fingerprinting, lease ownership, and stored response replay.

When NOT to use

  • Your operation is naturally idempotent (e.g., pure GET reads or deterministic PUT upserts with natural keys).

6. Core Capabilities & Design Invariants#

SHA-256 Fingerprinting & Value Objects

Stack-bounded IdempotencyKey and IdempotencyScope structs plus payload-tampering detection.

7 Storage Dialects & Replay

Atomic lease stores for PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, SQLite, and Redis Lua with ASP.NET Core middleware.

7. Included NuGet Packages & Adapters#

Package IDStatusNuGet / LocalTFMsAOT StatusDownloadsDescription
EricksonLopez.IdempotencyPrimaryPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full622Core domain logic, fingerprint hashing, serialization, and orchestration engine for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.AbstractionsPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full2,548Core abstractions, contracts, and domain primitives for the EricksonLopez.Idempotency library.
EricksonLopez.Idempotency.MySqlPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full317MySQL storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL.
EricksonLopez.Idempotency.TestingPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full285Testing utilities, in-memory test stores, and mock helpers for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.MariaDbPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full281MariaDB storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL.
EricksonLopez.Idempotency.PostgreSqlPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full277PostgreSQL storage provider for EricksonLopez.Idempotency using Dapper and raw SQL.
EricksonLopez.Idempotency.MediatorPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full275Mediator pipeline behavior integration for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.RedisPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full273Redis storage provider for EricksonLopez.Idempotency using StackExchange.Redis with Lua scripts for atomic operations. Note: Redis guarantees are slightly weaker than SQL providers (no fencing tokens); see docs/adr/adr-013-no-idistributedcache-abstraction.md for details.
EricksonLopez.Idempotency.OraclePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full270Oracle Database storage provider for EricksonLopez.Idempotency using Dapper, Oracle.ManagedDataAccess.Core, and raw SQL.
EricksonLopez.Idempotency.AspNetCorePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full267ASP.NET Core integration, endpoint filters, and middleware for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.ResultPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full266Result Pattern integration for EricksonLopez.Idempotency providing functional error factories and mapping.
EricksonLopez.Idempotency.SqlitePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full258SQLite storage provider for EricksonLopez.Idempotency using Dapper, Microsoft.Data.Sqlite, and raw SQL.
EricksonLopez.Idempotency.SqlServerPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full254Microsoft SQL Server storage provider for EricksonLopez.Idempotency using Dapper and raw SQL.

8. Quick Start Code Example#

Grounded in verified public APIs from EricksonLopez.Idempotency. Compile with `<ImplicitUsings>disable</ImplicitUsings>` and explicit imports.

using System;
using EricksonLopez.Idempotency;
using EricksonLopez.Idempotency.AspNetCore;
using EricksonLopez.Idempotency.PostgreSql;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Npgsql;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSingleton(_ =>
    NpgsqlDataSource.Create(builder.Configuration.GetConnectionString("Postgres")!));
builder.Services.AddPostgreSqlIdempotencyStore();
builder.Services.AddAspNetCoreIdempotency(options =>
{
    options.HeaderName = "Idempotency-Key";
    options.RequireIdempotencyKey = true;
    options.DefaultLeaseDuration = TimeSpan.FromSeconds(30);
    options.DefaultRetentionDuration = TimeSpan.FromDays(7);
});

9. Architecture & Dependency Flow#

flowchart LR
  lib_idempotency["EricksonLopez.Idempotency (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_idempotency -.-> lib_result
  lib_mediator["EricksonLopez.Mediator (L2)"]
  lib_idempotency -.-> lib_mediator
  lib_messaging["EricksonLopez.Messaging (L3)"]
  lib_messaging -.-> lib_idempotency
  lib_outbox["EricksonLopez.Outbox (L3)"]
  lib_outbox --> lib_idempotency
EricksonLopez.Idempotency Dependency Topology2 upstream library dependencies and 2 downstream dependent libraries verified in dependencies.json.
View accessible text summary and structure

2 upstream library dependencies and 2 downstream dependent libraries verified in dependencies.json.

DirectionLibraryTierRelationship Kinds
UpstreamEricksonLopez.ResultL0Adapter, NuGet Package
UpstreamEricksonLopez.MediatorL2Adapter, NuGet Package
DownstreamEricksonLopez.MessagingL3Adapter
DownstreamEricksonLopez.OutboxL3Compile-Time, NuGet Package
flowchart LR
  lib_idempotency["EricksonLopez.Idempotency (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_idempotency -.-> lib_result
  lib_mediator["EricksonLopez.Mediator (L2)"]
  lib_idempotency -.-> lib_mediator
  lib_messaging["EricksonLopez.Messaging (L3)"]
  lib_messaging -.-> lib_idempotency
  lib_outbox["EricksonLopez.Outbox (L3)"]
  lib_outbox --> lib_idempotency

10. Target Frameworks & Native AOT / Trimming Matrix#

MSBuild `.csproj` inspection across 13 packages: 13 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analyzers/generators).

Package IDIsAotCompatibleEnableTrimAnalyzerVerified AOT StatusTarget Frameworks
EricksonLopez.IdempotencytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.AbstractionstruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.MySqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.TestingtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.MariaDbtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.PostgreSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.MediatortruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.RedistruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.OracletruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.AspNetCoretruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.ResulttruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.SqlitetruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Idempotency.SqlServertruetrueFullnet8.0, net9.0, net10.0

11. Upstream Dependencies & Downstream Dependents#

Upstream Dependencies (2)

Downstream Dependents (2)

12. Optional Adapters & Third-Party Integrations#

Internal Adapter Edges & Integration Packages

Verified External NuGet Dependencies (12)

DapperMicrosoft.Data.SqlClientMicrosoft.Data.SqliteMicrosoft.Extensions.DependencyInjection.AbstractionsMicrosoft.Extensions.Hosting.AbstractionsMicrosoft.Extensions.Logging.AbstractionsMicrosoft.Extensions.OptionsMySqlConnectorNpgsqlOpenTelemetry.ApiOracle.ManagedDataAccess.CoreStackExchange.Redis

13. Configuration & DI Registration Summary#

Verified DI & Configuration Entry Points

  • ServiceCollectionExtensions.AddIdempotencyCleanupService

    Registers a hosted background service that periodically purges expired idempotency records from the store.

  • ServiceCollectionExtensions.AddIdempotencyCore

    Registers core idempotency abstractions, context accessors, serializers, and execution engines in the specified service collection.

  • AspNetCoreServiceCollectionExtensions.AddAspNetCoreIdempotency

    Registers ASP.NET Core endpoint filters, middleware dependencies, and core idempotency services in the specified service collection.

  • AspNetCoreServiceCollectionExtensions.UseIdempotency

    Enables the idempotency middleware in the ASP.NET Core HTTP request pipeline.

  • IdempotencyOptionsAspNetCoreExtensions.UseTenantIdExtractor

    Configures a typed `HttpContext` extractor delegate for resolving tenant identifiers.

  • MariaDbServiceCollectionExtensions.AddMariaDbIdempotencyStore

    Registers the MariaDB implementation of `IIdempotencyStore` and `ITransactionalIdempotencyStore` in the specified service collection.

  • MediatorServiceCollectionExtensions.AddMediatorIdempotency

    Registers the open generic `IdempotencyPipelineBehavior<TRequest, TResponse>` and core idempotency dependencies in the specified service collection.

  • MySqlServiceCollectionExtensions.AddMySqlIdempotencyStore

    Registers the MySQL implementation of `IIdempotencyStore` and `ITransactionalIdempotencyStore` in the specified service collection.

  • OracleServiceCollectionExtensions.AddOracleIdempotencyStore

    Registers the Oracle Database implementation of `IIdempotencyStore` in the specified service collection.

  • PostgreSqlServiceCollectionExtensions.AddPostgreSqlIdempotencyStore

    Registers the PostgreSQL implementation of `IIdempotencyStore` in the specified service collection.

  • RedisServiceCollectionExtensions.AddRedisIdempotency

    Registers `RedisIdempotencyStore` as the `IIdempotencyStore` implementation, using an existing `IConnectionMultiplexer` registered in the DI container.

  • SqlServerServiceCollectionExtensions.AddSqlServerIdempotencyStore

    Registers the SQL Server implementation of `IIdempotencyStore` in the specified service collection.

Key Public Types & Contracts

  • EricksonLopez.Idempotency.AsyncLocalIdempotencyContextAccessor (class)

    Provides access to the ambient `IdempotencyContext` flowed across asynchronous execution contexts.

  • EricksonLopez.Idempotency.CachedIdempotencyResponse (record)

    Represents the cached HTTP or application response associated with a completed idempotent operation.

  • EricksonLopez.Idempotency.ClaimResultStatus (enum)

    Defines the specific outcome of an attempt to acquire ownership or claim an idempotency key.

  • EricksonLopez.Idempotency.DefaultIdempotencyPolicy (class)

    Provides a default evaluation policy for idempotent operation execution based on configured options.

  • EricksonLopez.Idempotency.ExecutionResponse (record)

    Represents the protocol-agnostic response produced by an executed operation, containing the status code, response headers, and raw body payload.

  • EricksonLopez.Idempotency.FallbackCacheEntry (record)

    Represents a cached response entry stored within the in-memory fallback cache.

  • EricksonLopez.Idempotency.IFallbackCache (interface)

    Defines the abstraction for an in-memory fallback cache to provide high-resilience idempotency replay when the primary persistent storage provider is unavailable.

  • EricksonLopez.Idempotency.IIdempotencyContextAccessor (interface)

    Provides access to the current `IdempotencyContext`.

  • EricksonLopez.Idempotency.IIdempotencyFingerprintGenerator (interface)

    Defines a strategy for computing deterministic fingerprints from request components.

  • EricksonLopez.Idempotency.IIdempotencyKeyProvider`1 (interface)

    Defines a strategy for resolving an idempotency key from an incoming request or message context.

  • EricksonLopez.Idempotency.IIdempotencyPolicy (interface)

    Defines policy rules and evaluation criteria for idempotent operation execution.

  • EricksonLopez.Idempotency.IIdempotencySerializer (interface)

    Defines a contract for serializing and deserializing response and request payloads for idempotency storage.

14. Verified Performance Benchmarks#

All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

No non-MEGA-AUDIT `BenchmarkDotNet.Artifacts` files were verified for this library in the snapshot (`hasBenchmarks: false`).

15. Release History & NuGet vs Repo Status#

Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.1.0.

VersionSourcePublished DateSummary
v2.0.0 ↗nuget2026-09-25Published EricksonLopez.Idempotency 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-09-25[2.0.0](https://github.com/ericksonlopezf/dotnet-idempotency/compare/v1.0.0...v2.0.0) (2026-09-25) ⚠ BREAKING CHANGES * add relational outbox, uniform metadata and response headers blocklist ✨ Features * add relational outbox, uniform metadata and response headers blocklist ([1d8df51](https://github.com/ericksonlopezf/dotnet-idempotency/commit/1d8df510ea6d1a4215e7ee6c826688ec24ea9374))
v1.0.0 ↗github2026-08-29Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Idempotency.Abstractions` | `1.0.0` | | `EricksonLopez.Idempotency` | `1.0.0` | | `EricksonLopez.Idempotency.AspNetCore` | `1.0.0` | | `EricksonLopez.Idempotency.MariaDb` | `1.0.0` | | `EricksonLopez.Idempotency.Mediator` | `1.0.0` | | `EricksonLopez.Idempotency.MySql` | `1.0.0` | | `EricksonLopez.Id...
v1.0.0 ↗nuget2026-08-29Published EricksonLopez.Idempotency 1.0.0 to NuGet.org.

Libraries in the same tier, architectural layer, or directly paired via dependency edges.

17. Documentation, API Reference & Portal Links#

Per-library conceptual Starlight pages expand in M4; API Reference pages expand in M3.2.

18. Source Repository, License & Contributing#

Released under the MIT License. All assemblies follow EricksonLopez.* build invariants: explicit imports, strong-name signing (`EricksonLopez.snk`), and ASCII author metadata (`Erickson Lopez`).

19. Troubleshooting, Pitfalls & Migration Guidance#

  • Configure DefaultLeaseDuration longer than your downstream handler timeout so active requests are not reclaimed prematurely.
  • Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.1.0.

20. Quality & Verification Evidence#

Strong-Name Signing (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
XML Documentation Extraction
Verified (13 namespaces, 81 types, 364 members)
MSBuild AOT / Trim Attributes
13 Full / 0 Partial / 0 Incompatible / 0 N/A
BenchmarkDotNet Artifacts
0 total (0 measured, 0 na_error)

Explicit Verification Boundaries & Limitations

  • All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.