csharp-language-server-protocol icon indicating copy to clipboard operation
csharp-language-server-protocol copied to clipboard

Update dependency MediatR to v10

Open renovate[bot] opened this issue 3 years ago • 0 comments

Mend Renovate

This PR contains the following updates:

Package Type Update Change
MediatR nuget major 8.1.0 -> 10.0.1

Release Notes

jbogard/MediatR

v10.0.1

This is a patch release to support the latest Contracts package, which changed its targets to netstandard2.0 and net461.

Although MediatR supports only netstandard2.1 and above, it should not force the consumers of the contracts as such.

v10.0.0

This release adds support for IAsyncEnumerable<T>. A new request type, IStreamRequest<T> represents a request to create a stream, with a new handler type IStreamRequestHandler<TRequest, TResponse> to handle. An example:

public class StreamPing : IStreamRequest<Pong>
{
    public string? Message { get; init; }
}

public class PingStreamHandler : IStreamRequestHandler<StreamPing, Pong>
{
    public async IAsyncEnumerable<Pong> Handle(StreamPing request, 
        [EnumeratorCancellation] CancellationToken cancellationToken)
    {
        yield return await Task.Run(() => new Pong { Message = request.Message + " Pang" }, cancellationToken);
    }
}

Where the work inside of the handler would likely be calling some other streaming API, such as gRPC, EF Core streaming support, Dapper streaming etc.

There are also separate behaviors, with IStreamPipelineBehavior that are separate from the normal IPipelineBehavior.

With the addition of IAsyncEnumerable, this release now targets netstandard2.1 exclusively.

There are some breaking API changes, called out in the 10.0 migration guide.

v9.0.0

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.


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] If you want to rebase/retry this PR, click this checkbox.

This PR has been generated by Mend Renovate. View repository job log here.

renovate[bot] avatar Apr 28 '22 05:04 renovate[bot]