EricksonLopez.Idempotency
dotnet-idempotency · Fiabilidad y Concurrencia
En esta página (20 secciones)
1. Identidad, Nivel y Perfil de Madurez#
2. Propuesta de Valor y Problema que Resuelve#
High-performance, Native AOT-first architectural idempotency engine, lease fencing, deterministic SHA-256 fingerprinting, and distributed consistency for modern .NET.
Reintentos de red, timeouts y reentregas de mensajes provocan efectos duplicados cuando los endpoints o handlers carecen de leases atómicos y huellas de payload.
3. Instalación Rápida#
Paquete principal: EricksonLopez.Idempotency
dotnet add package EricksonLopez.Idempotency --version 2.0.0<PackageReference Include="EricksonLopez.Idempotency" Version="2.0.0" /><PackageVersion Include="EricksonLopez.Idempotency" Version="2.0.0" />4. Métricas Verificadas del Ecosistema#
Instantánea recuperada UTC: 2026-12-01
5. Cuándo Usar y Cuándo NO Usar#
Cuándo usar
- Necesitas idempotencia HTTP o en comandos Mediator con huellas SHA-256, propiedad de lease y reproducción de respuestas almacenadas.
Cuándo NO usar
- Tu operación ya es idempotente por naturaleza (lecturas GET puras o upserts deterministas con clave natural).
6. Capacidades Principales e Invariantes de Diseño#
Huellas SHA-256 y Value Objects
Structs IdempotencyKey e IdempotencyScope acotados en longitud más detección de alteración de payload.
7 Dialectos de Almacenamiento y Replay
Almacenes atómicos para PostgreSQL, SQL Server, MySQL, MariaDB, Oracle, SQLite y Redis Lua con middleware ASP.NET Core.
7. Paquetes NuGet y Adaptadores Incluidos#
| ID del Paquete | Estado | NuGet / Local | TFMs | Estado AOT | Descargas | Descripción |
|---|---|---|---|---|---|---|
| EricksonLopez.IdempotencyPrincipal | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 622 | Core domain logic, fingerprint hashing, serialization, and orchestration engine for EricksonLopez.Idempotency. |
| EricksonLopez.Idempotency.Abstractions | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 2,548 | Core abstractions, contracts, and domain primitives for the EricksonLopez.Idempotency library. |
| EricksonLopez.Idempotency.MySql | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 317 | MySQL storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL. |
| EricksonLopez.Idempotency.Testing | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 285 | Testing utilities, in-memory test stores, and mock helpers for EricksonLopez.Idempotency. |
| EricksonLopez.Idempotency.MariaDb | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 281 | MariaDB storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL. |
| EricksonLopez.Idempotency.PostgreSql | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 277 | PostgreSQL storage provider for EricksonLopez.Idempotency using Dapper and raw SQL. |
| EricksonLopez.Idempotency.Mediator | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 275 | Mediator pipeline behavior integration for EricksonLopez.Idempotency. |
| EricksonLopez.Idempotency.Redis | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 273 | Redis 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.Oracle | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 270 | Oracle Database storage provider for EricksonLopez.Idempotency using Dapper, Oracle.ManagedDataAccess.Core, and raw SQL. |
| EricksonLopez.Idempotency.AspNetCore | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 267 | ASP.NET Core integration, endpoint filters, and middleware for EricksonLopez.Idempotency. |
| EricksonLopez.Idempotency.Result | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 266 | Result Pattern integration for EricksonLopez.Idempotency providing functional error factories and mapping. |
| EricksonLopez.Idempotency.Sqlite | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 258 | SQLite storage provider for EricksonLopez.Idempotency using Dapper, Microsoft.Data.Sqlite, and raw SQL. |
| EricksonLopez.Idempotency.SqlServer | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 254 | Microsoft SQL Server storage provider for EricksonLopez.Idempotency using Dapper and raw SQL. |
8. Ejemplo Quick Start#
Basado en APIs públicas verificadas de EricksonLopez.Idempotency. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.
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. Arquitectura y Flujo de Dependencias#
Renderizando diagrama…
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
Ver descripción textual y tabla accesible
2 dependencias hacia librerías aguas arriba y 2 librerías dependientes aguas abajo verificadas en dependencies.json.
| Dirección | Librería | Nivel | Tipos de Relación |
|---|---|---|---|
| Aguas arriba | EricksonLopez.Result | L0 | Adaptador, Paquete NuGet |
| Aguas arriba | EricksonLopez.Mediator | L2 | Adaptador, Paquete NuGet |
| Aguas abajo | EricksonLopez.Messaging | L3 | Adaptador |
| Aguas abajo | EricksonLopez.Outbox | L3 | Tiempo de compilación, Paquete NuGet |
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_idempotency10. Target Frameworks y Matriz Native AOT / Trimming#
Inspección MSBuild `.csproj` sobre 13 paquetes: 13 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analizadores/generadores).
| ID del Paquete | IsAotCompatible | EnableTrimAnalyzer | Estado AOT Verificado | Target Frameworks |
|---|---|---|---|---|
| EricksonLopez.Idempotency | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Abstractions | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.MySql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Testing | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.MariaDb | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.PostgreSql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Mediator | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Redis | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Oracle | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.AspNetCore | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Result | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.Sqlite | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Idempotency.SqlServer | true | true | Full | net8.0, net9.0, net10.0 |
11. Dependencias Aguas Arriba y Dependientes Aguas Abajo#
Dependencias Aguas Arriba (2)
Dependientes Aguas Abajo (2)
12. Adaptadores Opcionales e Integraciones Externas#
Aristas de Adaptadores Internos y Paquetes de Integración
- EricksonLopez.Idempotency.Mediator→ EricksonLopez.Mediator (EricksonLopez.Mediator)
- EricksonLopez.Idempotency.Result→ EricksonLopez.Result (EricksonLopez.Result)
- EricksonLopez.Messaging.Idempotency (EricksonLopez.Messaging)→ EricksonLopez.Idempotency.Abstractions
Dependencias NuGet Externas Verificadas (12)
13. Resumen de Configuración y Registro en DI#
Puntos de Entrada DI y Configuración Verificados
ServiceCollectionExtensions.AddIdempotencyCleanupServiceRegisters a hosted background service that periodically purges expired idempotency records from the store.
ServiceCollectionExtensions.AddIdempotencyCoreRegisters core idempotency abstractions, context accessors, serializers, and execution engines in the specified service collection.
AspNetCoreServiceCollectionExtensions.AddAspNetCoreIdempotencyRegisters ASP.NET Core endpoint filters, middleware dependencies, and core idempotency services in the specified service collection.
AspNetCoreServiceCollectionExtensions.UseIdempotencyEnables the idempotency middleware in the ASP.NET Core HTTP request pipeline.
IdempotencyOptionsAspNetCoreExtensions.UseTenantIdExtractorConfigures a typed `HttpContext` extractor delegate for resolving tenant identifiers.
MariaDbServiceCollectionExtensions.AddMariaDbIdempotencyStoreRegisters the MariaDB implementation of `IIdempotencyStore` and `ITransactionalIdempotencyStore` in the specified service collection.
MediatorServiceCollectionExtensions.AddMediatorIdempotencyRegisters the open generic `IdempotencyPipelineBehavior<TRequest, TResponse>` and core idempotency dependencies in the specified service collection.
MySqlServiceCollectionExtensions.AddMySqlIdempotencyStoreRegisters the MySQL implementation of `IIdempotencyStore` and `ITransactionalIdempotencyStore` in the specified service collection.
OracleServiceCollectionExtensions.AddOracleIdempotencyStoreRegisters the Oracle Database implementation of `IIdempotencyStore` in the specified service collection.
PostgreSqlServiceCollectionExtensions.AddPostgreSqlIdempotencyStoreRegisters the PostgreSQL implementation of `IIdempotencyStore` in the specified service collection.
RedisServiceCollectionExtensions.AddRedisIdempotencyRegisters `RedisIdempotencyStore` as the `IIdempotencyStore` implementation, using an existing `IConnectionMultiplexer` registered in the DI container.
SqlServerServiceCollectionExtensions.AddSqlServerIdempotencyStoreRegisters the SQL Server implementation of `IIdempotencyStore` in the specified service collection.
Tipos Públicos y Contratos Clave
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. Benchmarks de Rendimiento Verificados#
Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).
No se verificaron archivos `BenchmarkDotNet.Artifacts` no-MEGA-AUDIT para esta librería en la instantánea (`hasBenchmarks: false`).
15. Historial de Versiones y Estado NuGet vs Repositorio#
Desfase de versiones detectado: la última versión publicada en NuGet.org es v2.0.0, mientras el HEAD del repositorio local está en v3.1.0.
| Versión | Origen | Fecha de Publicación | Resumen |
|---|---|---|---|
| v2.0.0 ↗ | nuget | 2026-09-25 | Published EricksonLopez.Idempotency 2.0.0 to NuGet.org. |
| v2.0.0 ↗ | github | 2026-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 ↗ | github | 2026-08-29 | Ecosystem 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 ↗ | nuget | 2026-08-29 | Published EricksonLopez.Idempotency 1.0.0 to NuGet.org. |
16. Librerías Complementarias y Relacionadas#
Librerías en el mismo nivel, capa arquitectónica o vinculadas directamente mediante aristas de dependencia.
17. Documentación, API Reference y Enlaces del Portal#
Documentación Conceptual (Starlight) →
Referencia de API XML Extraída →
13 namespaces · 81 tipos · 364 miembros
Mapa de Dependencias del Ecosistema →
Centro de Aprendizaje y Manual →
Las páginas conceptuales por librería en Starlight se completan en M4; las páginas de API Reference en M3.2.
18. Repositorio Fuente, Licencia y Contribución#
Publicado bajo Licencia MIT. Todos los ensamblados cumplen los invariantes de compilación EricksonLopez.*: importaciones explícitas, firma fuerte (`EricksonLopez.snk`) y metadatos de autor en ASCII (`Erickson Lopez`).
19. Resolución de Problemas, Riesgos y Migración#
- Configura DefaultLeaseDuration mayor que el timeout del handler para evitar expiración prematura de leases activos.
- Desfase de versiones detectado: la última versión publicada en NuGet.org es v2.0.0, mientras el HEAD del repositorio local está en v3.1.0.
20. Evidencia de Calidad y Verificación#
- Firma Fuerte (`EricksonLopez.snk`)
- EricksonLopez.snk
- `ImplicitUsings=disable`
- disable
- Extracción de Documentación XML
- Verificado (13 namespaces, 81 tipos, 364 miembros)
- Atributos MSBuild AOT / Trimming
- 13 Full / 0 Partial / 0 Incompatible / 0 N/A
- Artefactos BenchmarkDotNet
- 0 total (0 measured, 0 na_error)
Límites Explícitos de Verificación y Alcance
- Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).