public static Task <OperationResult <TNext> > ContinueOnSuccessAsync <TPrev, TNext>(this OperationResult <TPrev> prevOperationResult, AsyncFunc <TPrev, OperationResult <TNext> > nextOperation)
 => prevOperationResult.AssertNotNull(nameof(prevOperationResult))
 .IsSuccess
         ? prevOperationResult
 .ContinueAsync(x => nextOperation.AssertNotNull(nameof(nextOperation))
                .Invoke(prevOperationResult.Value))
         : Task.FromResult(prevOperationResult.AsFailure <TNext>());
Пример #2
0
 public static Task <OperationResult> ContinueWhenAsync(this OperationResult prevOperationResult, bool condition, AsyncFunc <OperationResult, OperationResult> nextOperation)
 => condition
         ? prevOperationResult
 .ContinueAsync(nextOperation)
         : Task.FromResult(prevOperationResult);