mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-12-05 07:42:34 +01:00
22 lines
710 B
C#
22 lines
710 B
C#
using System;
|
|||
|
|
using System.Threading.Tasks;
|
||
|
|
|
||
|
|
namespace WotBlitzStatisticsPro.Logic.Pipeline
|
||
|
|
{
|
||
|
|
public class OperationMediator<TContext>: IOperation<TContext>
|
||
|
|
{
|
||
|
|
private readonly IOperation<TContext> _current;
|
||
|
|
private readonly IOperation<TContext> _next;
|
||
|
|
|
||
|
|
public OperationMediator(IOperation<TContext> current, IOperation<TContext> next)
|
||
|
|
{
|
||
|
|
_current = current ?? throw new ArgumentNullException(nameof(current));
|
||
|
|
_next = next;
|
||
|
|
}
|
||
|
|
|
||
|
|
public Task Invoke(TContext context, Func<TContext, Task> next)
|
||
|
|
{
|
||
|
|
return _current.Invoke(context, c => _next == null ? Task.CompletedTask : _next.Invoke(c, null));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|