Skip to content

Commit

Permalink
Merge pull request #53 from hadashiA/master
Browse files Browse the repository at this point in the history
Add `[Preserve]` to AsyncRequestHandler
  • Loading branch information
neuecc authored Jun 9, 2021
2 parents 2e78be5 + bea3bca commit 4a2cc6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ namespace MessagePipe
{
// async

[Preserve]
public sealed class AsyncRequestHandler<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse>
{
readonly IAsyncRequestHandlerCore<TRequest, TResponse> handler;

[Preserve]
public AsyncRequestHandler(IAsyncRequestHandlerCore<TRequest, TResponse> handler, FilterAttachedAsyncRequestHandlerFactory handlerFactory)
{
this.handler = handlerFactory.CreateAsyncRequestHandler<TRequest, TResponse>(handler);
Expand All @@ -25,11 +27,13 @@ public UniTask<TResponse> InvokeAsync(TRequest request, CancellationToken cancel
}
}

[Preserve]
public sealed class AsyncRequestAllHandler<TRequest, TResponse> : IAsyncRequestAllHandler<TRequest, TResponse>
{
readonly IAsyncRequestHandlerCore<TRequest, TResponse>[] handlers;
readonly AsyncPublishStrategy defaultAsyncPublishStrategy;

[Preserve]
public AsyncRequestAllHandler(IEnumerable<IAsyncRequestHandlerCore<TRequest, TResponse>> handlers, FilterAttachedAsyncRequestHandlerFactory handlerFactory, MessagePipeOptions options)
{
var collection = (handlers as ICollection<IAsyncRequestHandlerCore<TRequest, TResponse>>) ?? handlers.ToArray();
Expand Down
4 changes: 4 additions & 0 deletions src/MessagePipe/AsyncRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ namespace MessagePipe
{
// async

[Preserve]
public sealed class AsyncRequestHandler<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse>
{
readonly IAsyncRequestHandlerCore<TRequest, TResponse> handler;

[Preserve]
public AsyncRequestHandler(IAsyncRequestHandlerCore<TRequest, TResponse> handler, FilterAttachedAsyncRequestHandlerFactory handlerFactory)
{
this.handler = handlerFactory.CreateAsyncRequestHandler<TRequest, TResponse>(handler);
Expand All @@ -25,11 +27,13 @@ public ValueTask<TResponse> InvokeAsync(TRequest request, CancellationToken canc
}
}

[Preserve]
public sealed class AsyncRequestAllHandler<TRequest, TResponse> : IAsyncRequestAllHandler<TRequest, TResponse>
{
readonly IAsyncRequestHandlerCore<TRequest, TResponse>[] handlers;
readonly AsyncPublishStrategy defaultAsyncPublishStrategy;

[Preserve]
public AsyncRequestAllHandler(IEnumerable<IAsyncRequestHandlerCore<TRequest, TResponse>> handlers, FilterAttachedAsyncRequestHandlerFactory handlerFactory, MessagePipeOptions options)
{
var collection = (handlers as ICollection<IAsyncRequestHandlerCore<TRequest, TResponse>>) ?? handlers.ToArray();
Expand Down

0 comments on commit 4a2cc6a

Please sign in to comment.