This release brings a major overhaul to the API of MediatR. The IMediator interface is now async-only, supporting optional cancellation tokens. The 'Async' postfix was not added onto the Send/Publish method names as there are no sync overloads.
On the handler side, you no longer need to build specific request/response types for sync/async. All request/notification types are IRequest
or INotification
. Instead, MediatR finds the appropriate handler implementation based on IRequestHandler
, IAsyncRequestHandler
and ICancellableAsyncRequestHandler
.
The base class for RequestHandler
is gone as well, with just the interfaces remaining.
New in this release are built-in support for pipelines through behaviors, which you can find more information about in the wiki.