Overview
The Mediator pipeline diagram shows the 7 pipeline behaviors each request passes through before reaching its handler. Requests enter via LoggingPipelineBehavior, then flow through ActivityAudit, Authorization, Validation, Transaction, DomainEventDispatch, and finally reach the actual CommandHandler or QueryHandler.
Each behavior has a clear, independently testable responsibility.
Key takeaways
- LoggingPipelineBehavior — OTel distributed tracing + structured logging
- AuthorizationPipelineBehavior — default-deny unified authorization check
- ValidationPipelineBehavior — runs all registered IRequestRule implementations
- TransactionPipelineBehavior — starts a UoW transaction only for commands (ICommand)
- IdempotencyPipelineBehavior — deduplicates only messages implementing IIdempotentRequest
- Pipeline behaviors execute in a fixed order determined by DI registration
Related
- Vertical Slice — pipeline usage in slices
- Idempotency — idempotent pipeline deep dive
- Error handling — the Result<T> pattern