Example #1
0
        public static async Task Call(this ICommander commander,
                                      ICommand command, bool isolate, CancellationToken cancellationToken = default)
        {
            var context = await commander.Run(command, isolate, cancellationToken).ConfigureAwait(false);

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

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

            commander.Run(context, isolate, cancellationToken).Ignore();
            return(context);
        }
Example #4
0
        // Call overloads

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

            var typedContext = (CommandContext <TResult>)context;

            return(await typedContext.ResultTask.ConfigureAwait(false));
        }
Example #5
0
        // Run overloads

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