Ir al contenido

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.

EricksonLopez.Mediator — Visión General

EricksonLopez.Mediator (2.0.0 en NuGet, L2) es un mediador CQRS generado en compilación que ejecuta comandos, consultas, notificaciones y streams basados en ValueTask sin reflexión en tiempo de ejecución.

  • Registro DI y despacho generados (EricksonLopez.Mediator.Generator): Emite AddEricksonLopezMediator() y cableado fuertemente tipado en compilación junto con diagnósticos ELM001–ELM013.
  • Continuaciones sin asignaciones: IPipelineBehavior<in TRequest, TResponse> restringe where TNext : struct, INext<TResponse> para invocar next.InvokeAsync() sin clausuras en el heap.
  • StaticMediator y límite de recursión: StaticMediator permite despacho AOT sin contenedor DI (Freeze(), SendCommand, SendQuery, Publish), y MaxRecursionDepthBehavior evita bucles infinitos.
  • Puente Polly obsoleto (v2.0.0): EricksonLopez.Mediator.Polly está marcado como [Obsolete] (ADR-036) — usa EricksonLopez.Resilience.Mediator.
flowchart LR
App["Caller -> ISender"] --> Gen["Generated Dispatch (Scoped)"]
Gen --> B1["IPipelineBehavior<TReq, TRes> (INext<TRes> struct)"]
B1 -- next.InvokeAsync() --> H["ICommandHandler / IQueryHandler -> ValueTask<TRes>"]
Pipeline de Despacho del Mediador GeneradoISender enruta comandos y consultas a través de continuaciones IPipelineBehavior restringidas por struct (next.InvokeAsync()) hacia manejadores generados ICommandHandler o IQueryHandler.
Ver descripción textual y tabla accesible

ISender enruta comandos y consultas a través de continuaciones IPipelineBehavior restringidas por struct (next.InvokeAsync()) hacia manejadores generados ICommandHandler o IQueryHandler.

flowchart LR
App["Caller -> ISender"] --> Gen["Generated Dispatch (Scoped)"]
Gen --> B1["IPipelineBehavior<TReq, TRes> (INext<TRes> struct)"]
B1 -- next.InvokeAsync() --> H["ICommandHandler / IQueryHandler -> ValueTask<TRes>"]

9 de 10 paquetes están publicados en 2.0.0 en NuGet (7,953 descargas totales; localVersion: 3.2.0 en disco), mientras EricksonLopez.Mediator.Caching permanece sin publicar (3.2.0 solo local). Estado AOT global Partial (8 Full, 1 Incompatible, 1 NotApplicable):

  • Publicados (2.0.0, AOT Full, 7 paquetes): Mediator (5,569), OpenTelemetry (409), Testing (298), Result (292), RateLimiting (283), AspNetCore (262), Polly (261, [Obsolete]).
  • Publicados (2.0.0, AOT Incompatible, 1 paquete): Mediator.FluentValidation (332, IsAotCompatible=false por escaneo de ensamblados).
  • Publicado (2.0.0, Roslyn NotApplicable, 1 paquete): Mediator.Generator (247, netstandard2.0).
  • Sin publicar (Local 3.2.0, AOT Full, 1 paquete): Mediator.Caching (0 descargas).

Medidos desde BenchmarkDotNet.Artifacts (38 filas medidas, 0 na_error) en .NET 8.0.31, .NET 9.0.20, .NET 10.0.10 y .NET 10.0.12 X64 RyuJIT (sin reportes NativeAOT):

  • MediatorBenchmarks.DirectCall: 0.1769 ns / 0 B (.NET 10.0.10 RyuJIT x86-64-v4)
  • MediatorBenchmarks.SendCommand_NoBehaviors: 11.1858 ns / 24 B (.NET 10.0.10 RyuJIT x86-64-v4)
  • MediatorBenchmarks.SendQuery_NoBehaviors: 15.6645 ns / 0 B (.NET 10.0.12 RyuJIT x86-64-v3)
  • MediatorBenchmarks.SendCommand_OneBehavior: 47.1593 ns / 0 B (.NET 10.0.12 RyuJIT x86-64-v3)
  • MediatorBenchmarks.SendCommand_FiveBehaviors: 183.9336 ns / 0 B (.NET 10.0.12 RyuJIT x86-64-v3)
  • MediatorBenchmarks.PublishNotification_OneHandler: 40.3239 ns / 24 B (FiveHandlers: 199.3251 ns / 120 B; Parallel: 183.3404 ns / 192 B)