/// <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); } }
/// <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) { }
/// <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;