Exemplo n.º 1
0
        public static async Task CallAsync(this ICommander commander,
                                           ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = await commander.RunAsync(command, isolate, cancellationToken).ConfigureAwait(false);

            await context.UntypedResultTask.ConfigureAwait(false);
        }
Exemplo n.º 2
0
        public static async Task <CommandContext> RunAsync(this ICommander commander,
                                                           ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = CommandContext.New(commander, command, isolate);
            await commander.RunAsync(context, isolate, cancellationToken).ConfigureAwait(false);

            return(context);
        }
Exemplo n.º 3
0
        public static CommandContext Start(this ICommander commander,
                                           ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = CommandContext.New(commander, command, isolate);

            commander.RunAsync(context, isolate, cancellationToken).Ignore();
            return(context);
        }
Exemplo n.º 4
0
        // CallAsync overloads

        public static async Task <TResult> CallAsync <TResult>(this ICommander commander,
                                                               ICommand <TResult> command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = await commander.RunAsync(command, isolate, cancellationToken).ConfigureAwait(false);

            var typedContext = (CommandContext <TResult>)context;

            return(await typedContext.ResultTask.ConfigureAwait(false));
        }
Exemplo n.º 5
0
        // RunAsync overloads

        public static Task <CommandContext> RunAsync(this ICommander commander,
                                                     ICommand command, CancellationToken cancellationToken = default)
        => commander.RunAsync(command, false, cancellationToken);