Table of Contents

Namespace Trellis.Mediator

Classes

AuthorizationBehavior<TMessage, TResponse>

Pipeline behavior that checks the current actor has all permissions declared in RequiredPermissions. Short-circuits with Error.Forbidden if any permission is missing.

ExceptionBehavior<TMessage, TResponse>

Pipeline behavior that catches unhandled exceptions from handlers and converts them to Error.InternalServerError failures. This is a safety net — handlers should not throw, but if they do, this prevents unhandled exceptions from escaping the mediator pipeline.

LoggingBehavior<TMessage, TResponse>

Pipeline behavior that logs command/query execution with duration and Result outcome. Logs at Information level for success, Warning level for failure.

ResourceAuthorizationBehavior<TMessage, TResource, TResponse>

Pipeline behavior that loads a resource and performs resource-based authorization before the handler runs. Registered as scoped so the injected IServiceProvider is the request-scoped provider, allowing correct resolution of scoped dependencies.

ServiceCollectionExtensions

Extension methods for registering Trellis.Mediator pipeline behaviors.

TracingBehavior<TMessage, TResponse>

Pipeline behavior that creates an OpenTelemetry Activity for each command/query. Tags the activity with Result status and error details on failure.

TrellisMediatorTelemetryOptions

Operator-tunable redaction settings for the Trellis mediator pipeline's logging and tracing behaviors. Resolved from DI; if not registered, the behaviors fall back to the safe-by-default values exposed by this type's parameterless constructor.

ValidationBehavior<TMessage, TResponse>

Unified validation stage of the Trellis Mediator pipeline. Runs the compile-time IValidate contract (when the message implements it) and every IMessageValidator<TMessage> registered for TMessage in DI, aggregates all Error.UnprocessableContent failures into a single response failure, and short-circuits the pipeline before the handler is invoked.

Interfaces

IMessageValidator<TMessage>

Contributes a validation step to the unified validation stage of the Trellis Mediator pipeline (ValidationBehavior<TMessage, TResponse>).

IValidate

Marker interface for commands/queries that can self-validate before reaching the handler. Implement on command/query records to enable the ValidationBehavior<TMessage, TResponse>.