MediatR v9.0.0 Release Notes
Release Date: 2020-10-09 // over 2 years ago-
๐ This release contains a small, but breaking change. In order to provide a simpler interface, the
IMediator
interface is now split into two interfaces, a sender and publisher:public interface ISender{ Task\<TResponse\> Send\<TResponse\>(IRequest\<TResponse\> request, CancellationToken cancellationToken = default); Task\<object?\> Send(object request, CancellationToken cancellationToken = default); }public interface IPublisher{ Task Publish(object notification, CancellationToken cancellationToken = default); Task Publish\<TNotification\>(TNotification notification, CancellationToken cancellationToken = default) where TNotification : INotification; }public interface IMediator : ISender, IPublisher{ }
The main motivation here is that sending should be a top-level concern of an application, but publishing can happen anywhere. This interface segregation should help catch design errors, where should never send requests from anywhere inside a request handler.
Previous changes from v8.0.2
-
๐ This is a minor release to add support for nullable reference types and target
netstandard2.1
(#518).