예제 #1
0
        // CallAsync overloads

        public static async Task <TResult> CallAsync <TResult>(this ICommander commander,
                                                               ICommand <TResult> command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context      = commander.Start(command, isolate, cancellationToken);
            var typedContext = (CommandContext <TResult>)context;

            return(await typedContext.ResultTask.ConfigureAwait(false));
        }
예제 #2
0
        // Start overloads

        public static CommandContext Start(this ICommander commander,
                                           ICommand command, CancellationToken cancellationToken = default)
        => commander.Start(command, false, cancellationToken);
예제 #3
0
 public static async Task CallAsync(this ICommander commander,
                                    ICommand command, bool isolate, CancellationToken cancellationToken = default)
 {
     var context = commander.Start(command, isolate, cancellationToken);
     await context.UntypedResultTask.ConfigureAwait(false);
 }