예제 #1
0
        /// <summary>
        /// Awaitably handles the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="ct">A cancellation token (optional). Can be used to signal that the pipeline should end by the caller</param>
        /// <returns>Awaitable <see cref="Task{TRequest}"/>.</returns>
        public virtual async Task <TRequest> HandleAsync(TRequest command, CancellationToken?ct = null)
        {
            if (_successor != null)
            {
                logger.DebugFormat("Passing request from {0} to {1}", Name, _successor.Name);
                return(await _successor.HandleAsync(command, ct).ConfigureAwait(ContinueOnCapturedContext));
            }

            return(command);
        }
예제 #2
0
        /// <summary>
        /// Awaitably handles the specified command.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="cancellationToken">A cancellation token (optional). Can be used to signal that the pipeline should end by the caller</param>
        /// <returns>Awaitable <see cref="Task{TRequest}"/>.</returns>
        public virtual async Task <TRequest> HandleAsync(TRequest command, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_successor != null)
            {
                s_logger.LogDebug("Passing request from {HandlerName} to {NextHandler}", Name, _successor.Name);
                return(await _successor.HandleAsync(command, cancellationToken).ConfigureAwait(ContinueOnCapturedContext));
            }

            return(command);
        }