protected async override Task RunAsync(Execution <HandleContext> execution) { try { using (IHandlerInstance handler = await CreateHandler.RunAsync(execution.Context).ConfigureAwait(false)) { var handleContext = new HandlerContext(execution.Context.Message.Payload, handler.Current, execution.Context.Message); await BeginHandle.RunAsync(handleContext).ConfigureAwait(false); await ActualHandle.RunAsync(handleContext).ConfigureAwait(false); await EndHandle.RunAsync(handleContext).ConfigureAwait(false); } } catch (Exception ex) { var context = new ErrorContext(ex, execution.Context.Message, execution.Context.HandlerType); context.AssignPropertySafely <IWorkflowContextWithServiceProvider>(prop => prop.ServiceProvider = execution.Context.ServiceProvider); await Error.RunAsync(context).ConfigureAwait(false); throw; } finally { await Finalize.RunAsync(execution.Context).ConfigureAwait(false); } }