Builders
Namespace: RA.Utilities.Dispatcher.Builders
The RA.Utilities.Dispatcher.Builders namespace holds the fluent builders returned by AddDispatcher / AddNotification. They implement the Builder Pattern: each configuration call returns the builder, so you define an entire vertical slice in a single, coherent block of code.
🏗️ Available Builders
| Builder | Returned By | Configures |
|---|---|---|
DispatcherBuilder<TRequest> | AddDispatcher<TRequest, THandler>() | Behaviors and validators for a request without a response |
DispatcherBuilder<TRequest, TResponse> | AddDispatcher<TRequest, TResponse, THandler>() | Behaviors and validators for a request with a response |
NotificationDispatcherBuilder<TNotification> | AddNotification<TNotification>() | Handlers and behaviors for a notification |
All three implement IDispatcherBuilder and expose the IServiceCollection being configured.
🚀 Example
_ = services
.AddDispatcher<CreateProductCommand, int, CreateProductHandler>() // 1. Starts with the extension method
.AddDecoration<LoggingBehavior<CreateProductCommand, int>>() // 2. Chains a behavior from the returned builder
.AddValidator<CreateProductCommandValidator>(); // 3. Chains a validator from the builder
DispatcherBuilder
DispatcherBuilder and DispatcherBuilder are the fluent builders returned by AddDispatcher(). They configure the pipeline of a single request: decorations (behaviors) and validators.
NotificationDispatcherBuilder
NotificationDispatcherBuilder is the fluent builder returned by AddNotification(). It configures the handlers and the per-handler behavior pipeline of a single notification.