Exemplo n.º 1
0
        /// <inheritdoc />
        public async Task <IEnumerable <IDocument> > ExecuteAsync(IExecutionContext context)
        {
            BeforeExecution(context);
            await BeforeExecutionAsync(context);

            try
            {
                IEnumerable <IDocument> outputs = await ExecuteContextAsync(context);

                ExecutionOutputs executionOutputs = new ExecutionOutputs(outputs);
                AfterExecution(context, executionOutputs);
                await AfterExecutionAsync(context, executionOutputs);

                return(executionOutputs.Outputs);
            }
            finally
            {
                Finally(context);
                await FinallyAsync(context);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called after each module execution.
 /// </summary>
 /// <remarks>
 /// Override this method to examine or adjust the module outputs.
 /// If an exception is thrown during module execution, this method is never called.
 /// Use <see cref="Finally(IExecutionContext)"/> to clean up module state after execution.
 /// </remarks>
 /// <param name="context">The execution context.</param>
 /// <param name="outputs">
 /// The module outputs which can be modified by changing the <see cref="ExecutionOutputs.Outputs"/> property.
 /// </param>
 protected virtual void AfterExecution(IExecutionContext context, ExecutionOutputs outputs)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Called after each module execution.
 /// </summary>
 /// <remarks>
 /// Override this method to examine or adjust the module outputs.
 /// If an exception is thrown during module execution, this method is never called.
 /// Use <see cref="FinallyAsync(IExecutionContext)"/> to clean up module state after execution.
 /// </remarks>
 /// <param name="context">The execution context.</param>
 /// <param name="outputs">
 /// The module outputs which can be modified by changing the <see cref="ExecutionOutputs.Outputs"/> property.
 /// </param>
 protected virtual Task AfterExecutionAsync(IExecutionContext context, ExecutionOutputs outputs) => Task.CompletedTask;