EricksonLopez.Mediator

dotnet-mediator · CQRS y Mensajería

En esta página (20 secciones)

1. Identidad, Nivel y Perfil de Madurez#

L2 Transversal y FiabilidadEstableMantenimiento: ActivoAOT: ParcialLicencia MITConfianza: HIGH
Applicationnet8.0net9.0net10.0

2. Propuesta de Valor y Problema que Resuelve#

High-throughput, zero-allocation CQRS mediator ecosystem for modern .NET (8, 9, 10). Features Roslyn compile-time dispatch, Native AOT-ready core (Partial across sub-packages), and zero-overhead pipeline extensions for caching, telemetry, and validation.

Los mediadores basados en reflexión asignan envoltorios y cadenas de delegados por petición, diluyen contratos Command/Query y fallan en Native AOT estricto.

3. Instalación Rápida#

Paquete principal: EricksonLopez.Mediator

dotnet add package EricksonLopez.Mediator --version 2.0.0
También publicado en esta familia:
EricksonLopez.Mediator.OpenTelemetryEricksonLopez.Mediator.FluentValidationEricksonLopez.Mediator.TestingEricksonLopez.Mediator.ResultEricksonLopez.Mediator.RateLimitingEricksonLopez.Mediator.AspNetCore

4. Métricas Verificadas del Ecosistema#

v2.0.0
Versión Publicada en NuGet
v3.2.0
Versión HEAD del Repo
7,953
Descargas en NuGet
10
Paquetes Empaquetables
280
Miembros Públicos de API
38
Filas Benchmark (RyuJIT)

Instantánea recuperada UTC: 2026-12-01

5. Cuándo Usar y Cuándo NO Usar#

Cuándo usar

  • Quieres contratos CQRS segregados ICommand<T> / IQuery<T> / INotification con despacho generado en compilación por Roslyn.

Cuándo NO usar

  • Tus handlers solo emiten eventos simples sin pipelines de comando/consulta; usa EricksonLopez.Events.

6. Capacidades Principales e Invariantes de Diseño#

Contratos CQRS Segregados

Refuerza fronteras ICommand<T>, IQuery<T> e INotification con 13 analizadores Roslyn (ELM001–ELM013).

Continuaciones Struct y Adaptadores

Continuaciones INext<TResponse> por restricción struct más adaptadores para Caching, OpenTelemetry, Polly, Minimal APIs y FluentValidation.

7. Paquetes NuGet y Adaptadores Incluidos#

ID del PaqueteEstadoNuGet / LocalTFMsEstado AOTDescargasDescripción
EricksonLopez.MediatorPrincipalPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo5,569High-performance, zero-allocation, AOT-compatible mediator pattern implementation for .NET 10.
EricksonLopez.Mediator.OpenTelemetryPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo409OpenTelemetry distributed tracing and metrics instrumentation for EricksonLopez.Mediator.
EricksonLopez.Mediator.FluentValidationPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Incompatible332FluentValidation pipeline behavior and extensions for EricksonLopez.Mediator.
EricksonLopez.Mediator.TestingPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo298In-memory FakeMediator and testing doubles for EricksonLopez.Mediator.
EricksonLopez.Mediator.ResultPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo292Result pattern integration and pipeline short-circuiting abstractions for EricksonLopez.Mediator.
EricksonLopez.Mediator.RateLimitingPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo283Rate limiting pipeline behavior for EricksonLopez.Mediator based on System.Threading.RateLimiting.
EricksonLopez.Mediator.AspNetCorePublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo262ASP.NET Core Minimal API endpoint mapping extensions for EricksonLopez.Mediator.
EricksonLopez.Mediator.PollyPublicadov2.0.0 / v3.2.0net8.0, net9.0, net10.0AOT: Completo261Polly v8 resilience policies and pipeline integration for EricksonLopez.Mediator.
EricksonLopez.Mediator.GeneratorAnalizador / GeneradorPublicadov2.0.0 / v3.2.0netstandard2.0AOT: N/A (Analizador/Legado)247Source generator for EricksonLopez.Mediator.
EricksonLopez.Mediator.CachingNo publicado— / v3.2.0net8.0, net9.0, net10.0AOT: Completo0Query caching and cache invalidation pipeline behaviors for EricksonLopez.Mediator. Supports stampede-protected multi-tier caching and Native AOT compatibility.

8. Ejemplo Quick Start#

Basado en APIs públicas verificadas de EricksonLopez.Mediator. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.

using System;
using EricksonLopez.Mediator;

public sealed record CreateOrderCommand(string CustomerId, decimal Amount) : ICommand<Guid>;
public sealed record GetOrderByIdQuery(Guid OrderId) : IQuery<OrderDto?>;
public sealed record OrderDto(Guid OrderId, string CustomerId, decimal Amount, string Status);
public sealed record OrderCreatedEvent(Guid OrderId, string CustomerId) : INotification;

9. Arquitectura y Flujo de Dependencias#

flowchart LR
  lib_mediator["EricksonLopez.Mediator (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_mediator -.-> lib_result
  lib_caching["EricksonLopez.Caching (L2)"]
  lib_mediator -.-> lib_caching
  lib_concurrency["EricksonLopez.Concurrency (L2)"]
  lib_concurrency -.-> lib_mediator
  lib_idempotency["EricksonLopez.Idempotency (L2)"]
  lib_idempotency -.-> lib_mediator
  lib_resilience["EricksonLopez.Resilience (L2)"]
  lib_resilience -.-> lib_mediator
  lib_transaction["EricksonLopez.Transaction (L2)"]
  lib_transaction --> lib_mediator
  lib_outbox["EricksonLopez.Outbox (L3)"]
  lib_outbox --> lib_mediator
  lib_security["EricksonLopez.Security (L3)"]
  lib_security -.-> lib_mediator
  lib_processes["EricksonLopez.Processes (L4)"]
  lib_processes --> lib_mediator
Topología de Dependencias de EricksonLopez.Mediator2 dependencias hacia librerías aguas arriba y 7 librerías dependientes aguas abajo verificadas en dependencies.json.
Ver descripción textual y tabla accesible

2 dependencias hacia librerías aguas arriba y 7 librerías dependientes aguas abajo verificadas en dependencies.json.

DirecciónLibreríaNivelTipos de Relación
Aguas arribaEricksonLopez.ResultL0Adaptador, Paquete NuGet
Aguas arribaEricksonLopez.CachingL2Adaptador
Aguas abajoEricksonLopez.ConcurrencyL2Adaptador, Paquete NuGet
Aguas abajoEricksonLopez.IdempotencyL2Adaptador, Paquete NuGet
Aguas abajoEricksonLopez.ResilienceL2Adaptador, Paquete NuGet
Aguas abajoEricksonLopez.TransactionL2Tiempo de compilación
Aguas abajoEricksonLopez.OutboxL3Adaptador, Tiempo de compilación, Paquete NuGet
Aguas abajoEricksonLopez.SecurityL3Adaptador
Aguas abajoEricksonLopez.ProcessesL4Tiempo de compilación, Paquete NuGet
flowchart LR
  lib_mediator["EricksonLopez.Mediator (L2)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_mediator -.-> lib_result
  lib_caching["EricksonLopez.Caching (L2)"]
  lib_mediator -.-> lib_caching
  lib_concurrency["EricksonLopez.Concurrency (L2)"]
  lib_concurrency -.-> lib_mediator
  lib_idempotency["EricksonLopez.Idempotency (L2)"]
  lib_idempotency -.-> lib_mediator
  lib_resilience["EricksonLopez.Resilience (L2)"]
  lib_resilience -.-> lib_mediator
  lib_transaction["EricksonLopez.Transaction (L2)"]
  lib_transaction --> lib_mediator
  lib_outbox["EricksonLopez.Outbox (L3)"]
  lib_outbox --> lib_mediator
  lib_security["EricksonLopez.Security (L3)"]
  lib_security -.-> lib_mediator
  lib_processes["EricksonLopez.Processes (L4)"]
  lib_processes --> lib_mediator

10. Target Frameworks y Matriz Native AOT / Trimming#

Inspección MSBuild `.csproj` sobre 10 paquetes: 8 Full, 0 Partial, 1 Incompatible, 1 NotApplicable (analizadores/generadores).

ID del PaqueteIsAotCompatibleEnableTrimAnalyzerEstado AOT VerificadoTarget Frameworks
EricksonLopez.MediatortruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.OpenTelemetrytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.FluentValidationfalsetrueIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.Mediator.TestingtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.ResulttruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.RateLimitingtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.AspNetCoretruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.PollytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Mediator.GeneratorfalsefalseNotApplicablenetstandard2.0
EricksonLopez.Mediator.CachingtruetrueFullnet8.0, net9.0, net10.0

11. Dependencias Aguas Arriba y Dependientes Aguas Abajo#

Dependencias Aguas Arriba (2)

Dependientes Aguas Abajo (7)

12. Adaptadores Opcionales e Integraciones Externas#

Aristas de Adaptadores Internos y Paquetes de Integración

Dependencias NuGet Externas Verificadas (6)

FluentValidationMicrosoft.Extensions.DependencyInjection.AbstractionsMicrosoft.Extensions.Diagnostics.HealthChecks.AbstractionsOpenTelemetry.ApiPolly.CoreSystem.Threading.RateLimiting

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

Puntos de Entrada DI y Configuración Verificados

  • MediatorHealthCheckExtensions.AddMediatorHealthCheck

    Registers `MediatorHealthCheck` with the specified service collection.

  • MediatorEndpointRouteBuilderExtensions.MapCommand<TCommand, TResponse>

    Maps an HTTP POST endpoint for the specified command type `TCommand`.

  • MediatorEndpointRouteBuilderExtensions.MapQuery<TQuery, TResponse>

    Maps an HTTP GET endpoint for the specified query type `TQuery`.

  • CachingMediatorExtensions.AddMediatorCacheInvalidation

    Registers the open generic `CacheInvalidationPipelineBehavior<TRequest, TResponse>` with the service collection.

  • CachingMediatorExtensions.AddMediatorCaching

    Registers the open generic `CachingPipelineBehavior<TRequest, TResponse>` with the service collection.

  • ServiceCollectionExtensions.AddMediatorOpenTelemetry

    Registers and configures OpenTelemetry instrumentation options for the mediator pipeline.

  • MediatorPollyExtensions.AddMediatorDefaultResiliencePipeline

    Configures and registers a default Polly resilience pipeline for the mediator.

  • MediatorPollyExtensions.AddMediatorPolly

    Registers the open generic `PollyResilienceBehavior<TRequest, TResponse>` with the service collection.

  • RateLimitingMediatorExtensions.AddMediatorRateLimiting

    Registers the rate limiting pipeline behavior with the service collection.

  • MediatorFluentValidationExtensions.AddMediatorFluentValidation

    Registers the open generic `ValidationPipelineBehavior<TRequest, TResponse>` as a pipeline behavior in the service collection.

  • MediatorFluentValidationExtensions.AddMediatorFluentValidationValidator<TValidator, TRequest>

    Registers a single FluentValidation validator explicitly, without assembly scanning.

  • MediatorFluentValidationExtensions.AddMediatorFluentValidatorsFromAssembly

    Discovers and registers all FluentValidation validators found in the specified assembly into the service collection.

Tipos Públicos y Contratos Clave

  • EricksonLopez.Mediator.DiscoverHandlersAttribute (class)

    Specifies a marker type whose containing assembly is scanned at compile time for mediator handlers and behaviors.

  • EricksonLopez.Mediator.HandlerLifetime (enum)

    Specifies the lifetime of a handler registration within the dependency injection container.

  • EricksonLopez.Mediator.ICommandHandler`2 (interface)

    Defines a handler for processing a command of type `TCommand`.

  • EricksonLopez.Mediator.ICommand`1 (interface)

    Defines a command that produces a response of type `TResponse`.

  • EricksonLopez.Mediator.IMediator (interface)

    Defines a mediator that combines message dispatching and notification publishing capabilities.

  • EricksonLopez.Mediator.INext (interface)

    Defines a callback delegate representing the next step in a notification processing pipeline.

  • EricksonLopez.Mediator.INext`1 (interface)

    Defines a callback delegate representing the next step in a request processing pipeline.

  • EricksonLopez.Mediator.INotification (interface)

    Defines a message that represents an event to be published to zero or more handlers.

  • EricksonLopez.Mediator.INotificationBehavior`1 (interface)

    Defines a cross-cutting behavior that surrounds notification handling within the mediator pipeline.

  • EricksonLopez.Mediator.INotificationHandler`1 (interface)

    Defines a handler for processing notifications of type `TNotification`.

  • EricksonLopez.Mediator.IPipelineBehavior`2 (interface)

    Defines a cross-cutting behavior that intercepts request processing within the mediator pipeline.

  • EricksonLopez.Mediator.IPublisher (interface)

    Defines a mechanism for publishing notification messages to registered handlers.

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

Filas totales: 38 · Medidos: 38 · NA / Error: 0 · Suites: 1

Runtimes observados: .NET 10.0.10 X64 RyuJIT x86-64-v4 · .NET 10.0.12 X64 RyuJIT x86-64-v3 · .NET 8.0.31 X64 RyuJIT x86-64-v3 · .NET 9.0.20 X64 RyuJIT x86-64-v3

CPUs observadas: AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores · AMD Ryzen 7 9800X3D 4.70GHz, 1 CPU, 8 logical and 8 physical cores

SuiteMétodoRuntimeMedia (ns)Asignado (B)Estado
MediatorBenchmarksDirectCall.NET 10.0.10 X64 RyuJIT x86-64-v40.1770measured
MediatorBenchmarksDirectCall.NET 8.0.31 X64 RyuJIT x86-64-v30.2960measured
MediatorBenchmarksDirectCall.NET 9.0.20 X64 RyuJIT x86-64-v30.330measured
MediatorBenchmarksDirectCall.NET 10.0.12 X64 RyuJIT x86-64-v30.5990measured
MediatorBenchmarksDirectCall.NET 10.0.12 X64 RyuJIT x86-64-v30.6010measured
MediatorBenchmarksSendCommand_NoBehaviors.NET 10.0.10 X64 RyuJIT x86-64-v411.18624measured
MediatorBenchmarksSendQuery_NoBehaviors.NET 10.0.12 X64 RyuJIT x86-64-v315.6650measured
MediatorBenchmarksSendQuery_NoBehaviors.NET 10.0.12 X64 RyuJIT x86-64-v315.8110measured
MediatorBenchmarksSendQuery_NoBehaviors.NET 9.0.20 X64 RyuJIT x86-64-v318.7090measured
MediatorBenchmarksSendCommand_NoBehaviors.NET 10.0.12 X64 RyuJIT x86-64-v321.0370measured
MediatorBenchmarksSendCommand_NoBehaviors.NET 10.0.12 X64 RyuJIT x86-64-v321.0960measured
MediatorBenchmarksSendCommand_NoBehaviors.NET 9.0.20 X64 RyuJIT x86-64-v324.8120measured
MediatorBenchmarksSendQuery_NoBehaviors.NET 8.0.31 X64 RyuJIT x86-64-v325.7450measured
MediatorBenchmarksSendCommand_NoBehaviors.NET 8.0.31 X64 RyuJIT x86-64-v326.1850measured
MediatorBenchmarksPublishNotification_OneHandler.NET 10.0.12 X64 RyuJIT x86-64-v340.32424measured
MediatorBenchmarksPublishNotification_OneHandler.NET 10.0.12 X64 RyuJIT x86-64-v341.37124measured
MediatorBenchmarksSendCommand_OneBehavior.NET 9.0.20 X64 RyuJIT x86-64-v345.810measured
MediatorBenchmarksSendCommand_OneBehavior.NET 10.0.12 X64 RyuJIT x86-64-v347.1590measured
MediatorBenchmarksSendCommand_OneBehavior.NET 10.0.12 X64 RyuJIT x86-64-v347.1860measured
MediatorBenchmarksPublishNotification_OneHandler.NET 9.0.20 X64 RyuJIT x86-64-v354.34924measured
MediatorBenchmarksPublishNotification_OneHandler.NET 8.0.31 X64 RyuJIT x86-64-v358.00724measured
MediatorBenchmarksSendCommand_OneBehavior.NET 8.0.31 X64 RyuJIT x86-64-v358.7110measured
MediatorBenchmarksNestedSend.NET 10.0.12 X64 RyuJIT x86-64-v370.87924measured
MediatorBenchmarksNestedSend.NET 10.0.12 X64 RyuJIT x86-64-v371.73424measured
MediatorBenchmarksNestedSend.NET 9.0.20 X64 RyuJIT x86-64-v379.65124measured

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

VersiónOrigenFecha de PublicaciónResumen
v2.0.0 ↗nuget2026-09-24Published EricksonLopez.Mediator 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-09-24Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Mediator` | `2.0.0` | | `EricksonLopez.Mediator.Generator` | `2.0.0` | | `EricksonLopez.Mediator.OpenTelemetry` | `2.0.0` | | `EricksonLopez.Mediator.Polly` | `2.0.0` | | `EricksonLopez.Mediator.Result` | `2.0.0` | | `EricksonLopez.Mediator.Testing` | `2.0.0` | | `EricksonLopez.Mediator.FluentValidat...
v1.0.0 ↗github2026-08-27Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Mediator` | `1.0.0` | | `EricksonLopez.Mediator.Generator` | `1.0.0` | | `EricksonLopez.Mediator.OpenTelemetry` | `1.0.0` | | `EricksonLopez.Mediator.Polly` | `1.0.0` | | `EricksonLopez.Mediator.Result` | `1.0.0` | | `EricksonLopez.Mediator.Testing` | `1.0.0` | | `EricksonLopez.Mediator.FluentValidat...
v1.0.0 ↗nuget2026-08-27Published EricksonLopez.Mediator 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#

  • Nota que aotStatus es Partial: EricksonLopez.Mediator.FluentValidation declara IsAotCompatible=false mientras el núcleo y otros 8 paquetes son Full AOT.
  • 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.2.0.

20. Evidencia de Calidad y Verificación#

Firma Fuerte (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
Extracción de Documentación XML
Verificado (14 namespaces, 90 tipos, 280 miembros)
Atributos MSBuild AOT / Trimming
8 Full / 0 Partial / 1 Incompatible / 1 N/A
Artefactos BenchmarkDotNet
38 total (38 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).
  • 1 no publicados

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.