MediatR 10.0 Released

MediatR 10.0.0 released today:

This release adds support for IAsyncEnumerable<T> with separate types for this separate kind of request/response:

  • IStreamRequest<TResponse>
  • IStreamRequestHandler<in TRequest, TResponse>
  • IStreamPipelineBehavior<in TRequest, TResponse>

And two new methods on IMediator:

  • IAsyncEnumerable<TResponse> CreateStream(IStreamRequest<TResponse> request, CancellationToken cancellationToken = default)
  • IAsyncEnumerable<object?> CreateStream(object request, CancellationToken cancellationToken = default)

With this addition, you can take advantage of streaming support of various APIs and hosts to build high-performant handlers. Because normal request/response is so radically different than streams, this new set of types and handlers is completely separate than the normal IRequest<TResponse> family.

Also, this release targets netstandard2.1 exclusively. That means you'll be able to use MediatR with any netstandard2.1-supported runtime, as well as .NET 5, .NET 6, and beyond.

The DI package was also upgraded and includes some other feature improvements as well.