Skip to content

Search EricksonLopez.* Ecosystem

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

EricksonLopez.Mediator Overview

EricksonLopez.Mediator (2.0.0 on NuGet, L2) is a source-generated CQRS mediator delivering ValueTask-based command, query, notification, and stream dispatch without runtime reflection or MediatR-style dynamic casting.

  • Source-generated DI & dispatch (EricksonLopez.Mediator.Generator): Emits AddEricksonLopezMediator() and strongly-typed handler wiring at compile time alongside ELM001–ELM013 diagnostics.
  • Zero-allocation pipeline continuations: IPipelineBehavior<in TRequest, TResponse> constrains where TNext : struct, INext<TResponse> so nested behaviors invoke next.InvokeAsync() without closure heap allocations.
  • Explicit StaticMediator & recursion guard: StaticMediator supports zero-DI AOT registration (Freeze(), SendCommand, SendQuery, Publish), while MaxRecursionDepthBehavior prevents unbounded self-dispatch.
  • Deprecated Polly bridge (v2.0.0): EricksonLopez.Mediator.Polly is marked [Obsolete] (ADR-036) — use EricksonLopez.Resilience.Mediator instead.
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>"]
Source-Generated Mediator Dispatch PipelineISender routes commands and queries through struct-constrained IPipelineBehavior continuations (next.InvokeAsync()) into source-generated ICommandHandler or IQueryHandler instances.
View accessible text summary and structure

ISender routes commands and queries through struct-constrained IPipelineBehavior continuations (next.InvokeAsync()) into source-generated ICommandHandler or IQueryHandler instances.

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 of 10 packages are published at 2.0.0 on NuGet (7,953 total downloads; localVersion: 3.2.0 on disk), while EricksonLopez.Mediator.Caching remains unpublished (3.2.0 local only). Overall AOT status is Partial (8 Full, 1 Incompatible, 1 NotApplicable):

Package NuGet (2.0.0) AOT Status TFMs Role
EricksonLopez.Mediator Published (5,569 dl) Full net8.0;net9.0;net10.0 ISender, IPublisher, StaticMediator, MaxRecursionDepthBehavior, MediatorHealthCheck
EricksonLopez.Mediator.Generator Published (247 dl) NotApplicable netstandard2.0 Incremental generator emitting AddEricksonLopezMediator() + analyzers
EricksonLopez.Mediator.OpenTelemetry Published (409 dl) Full net8.0;net9.0;net10.0 AddMediatorOpenTelemetry, MediatorMetrics
EricksonLopez.Mediator.FluentValidation Published (332 dl) Incompatible net8.0;net9.0;net10.0 IsAotCompatible=false (assembly scanning uses [RequiresUnreferencedCode]; generic validator registration is AOT-safe)
EricksonLopez.Mediator.Testing Published (298 dl) Full net8.0;net9.0;net10.0 FakeMediator, DelegateNext, MediatorPipelineParityVerifier
EricksonLopez.Mediator.Result Published (292 dl) Full net8.0;net9.0;net10.0 IResultFactory<TResponse>, InputSafetyPipelineBehavior<,>
EricksonLopez.Mediator.RateLimiting Published (283 dl) Full net8.0;net9.0;net10.0 AddMediatorRateLimiting via System.Threading.RateLimiting
EricksonLopez.Mediator.AspNetCore Published (262 dl) Full net8.0;net9.0;net10.0 MapCommand / MapQuery Minimal API endpoints
EricksonLopez.Mediator.Polly Published (261 dl) Full net8.0;net9.0;net10.0 Deprecated ([Obsolete]) — migrate to EricksonLopez.Resilience.Mediator
EricksonLopez.Mediator.Caching Unpublished Full net8.0;net9.0;net10.0 Local workspace 3.2.0 only (ICacheableRequest, AddMediatorCaching)

Measured directly from BenchmarkDotNet.Artifacts (38 measured rows, 0 na_error rows) across .NET 8.0.31, .NET 9.0.20, .NET 10.0.10, and .NET 10.0.12 X64 RyuJIT (no NativeAOT reports):

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