Core Concepts — Requests, ValueTask Handlers & Pipeline Behaviors
EricksonLopez.Mediator enforces compile-time request contracts and struct-constrained pipeline continuations.
Request & Handler Contracts (EricksonLopez.Mediator)
Section titled “Request & Handler Contracts (EricksonLopez.Mediator)”ICommand<TResponse>/ICommandHandler<in TCommand, TResponse>: ReturnsValueTask<TResponse>.IQuery<TResponse>/IQueryHandler<in TQuery, TResponse>: ReturnsValueTask<TResponse>.INotification/INotificationHandler<in TNotification>: ReturnsValueTask; supports[PublishStrategy(PublishStrategy)]and[NotificationOrder(int)].IStreamRequest<TResponse>: Streaming contract (note: namedIStreamRequest<T>, notIStreamQuery<T>), dispatched viaISender.CreateStream<TResponse>(...).
Struct-Constrained IPipelineBehavior<in TRequest, TResponse>
Section titled “Struct-Constrained IPipelineBehavior<in TRequest, TResponse>”ValueTask<TResponse> Handle<TNext>( TRequest request, TNext next, CancellationToken cancellationToken) where TNext : struct, INext<TResponse>;Invoke the downstream pipeline via await next.InvokeAsync() (zero-argument ValueTask<TResponse>), not next(). Attach behaviors declaratively with [UseBehavior(typeof(...), order: 0)] or [UseGlobalBehavior(...)].
StaticMediator allows explicit handler registration (RegisterCommandHandler, RegisterQueryHandler, RegisterNotificationHandler), Freeze(), IsFrozen, Reset(), and direct SendCommand / SendQuery / Publish calls without a ServiceProvider.