EricksonLopez.Idempotency

dotnet-idempotency · Fiabilidad y Concurrencia

En esta página (20 secciones)

1. Identidad, Nivel y Perfil de Madurez#

L2 Transversal y FiabilidadEstableMantenimiento: ActivoAOT: CompletoLicencia MITConfianza: HIGH
ApplicationInfrastructurenet8.0net9.0net10.0

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
También publicado en esta familia:
EricksonLopez.Idempotency.AbstractionsEricksonLopez.Idempotency.MySqlEricksonLopez.Idempotency.TestingEricksonLopez.Idempotency.MariaDbEricksonLopez.Idempotency.PostgreSqlEricksonLopez.Idempotency.Mediator

4. Métricas Verificadas del Ecosistema#

v2.0.0
Versión Publicada en NuGet
v3.1.0
Versión HEAD del Repo
6,193
Descargas en NuGet
13
Paquetes Empaquetables
364
Miembros Públicos de API
0
Filas Benchmark (RyuJIT)

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 PaqueteEstadoNuGet / LocalTFMsEstado AOTDescargasDescripción
EricksonLopez.IdempotencyPrincipalPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo622Core domain logic, fingerprint hashing, serialization, and orchestration engine for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.AbstractionsPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo2,548Core abstractions, contracts, and domain primitives for the EricksonLopez.Idempotency library.
EricksonLopez.Idempotency.MySqlPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo317MySQL storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL.
EricksonLopez.Idempotency.TestingPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo285Testing utilities, in-memory test stores, and mock helpers for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.MariaDbPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo281MariaDB storage provider for EricksonLopez.Idempotency using Dapper, MySqlConnector, and raw SQL.
EricksonLopez.Idempotency.PostgreSqlPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo277PostgreSQL storage provider for EricksonLopez.Idempotency using Dapper and raw SQL.
EricksonLopez.Idempotency.MediatorPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo275Mediator pipeline behavior integration for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.RedisPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo273Redis 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.OraclePublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo270Oracle Database storage provider for EricksonLopez.Idempotency using Dapper, Oracle.ManagedDataAccess.Core, and raw SQL.
EricksonLopez.Idempotency.AspNetCorePublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo267ASP.NET Core integration, endpoint filters, and middleware for EricksonLopez.Idempotency.
EricksonLopez.Idempotency.ResultPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo266Result Pattern integration for EricksonLopez.Idempotency providing functional error factories and mapping.
EricksonLopez.Idempotency.SqlitePublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo258SQLite storage provider for EricksonLopez.Idempotency using Dapper, Microsoft.Data.Sqlite, and raw SQL.
EricksonLopez.Idempotency.SqlServerPublicadov2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Completo254Microsoft 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#

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
Topología de Dependencias de EricksonLopez.Idempotency2 dependencias hacia librerías aguas arriba y 2 librerías dependientes aguas abajo verificadas en dependencies.json.
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ónLibreríaNivelTipos de Relación
Aguas arribaEricksonLopez.ResultL0Adaptador, Paquete NuGet
Aguas arribaEricksonLopez.MediatorL2Adaptador, Paquete NuGet
Aguas abajoEricksonLopez.MessagingL3Adaptador
Aguas abajoEricksonLopez.OutboxL3Tiempo 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_idempotency

10. 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 PaqueteIsAotCompatibleEnableTrimAnalyzerEstado AOT VerificadoTarget 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. 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

Dependencias NuGet Externas Verificadas (12)

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

13. Resumen de Configuración y Registro en DI#

Puntos de Entrada DI y Configuración Verificados

  • 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.

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ónOrigenFecha de PublicaciónResumen
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.

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#

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).

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.