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); } }
protected override void Run(Execution <HandleContext> execution) { try { using (IHandlerInstance handler = CreateHandler.Run(execution.Context)) { var handleContext = new HandlerContext(execution.Context.Message.Payload, handler.Current, execution.Context.Message); BeginHandle.Run(handleContext); new DiagnosticsWorkflow <HandlerContext>(ActualHandle).Run(handleContext); EndHandle.Run(handleContext); } } catch (Exception ex) { Error.Run(new ErrorContext(ex, execution.Context.Message, execution.Context.HandlerType)); throw; } finally { Finalize.Run(execution.Context); } }
public IHandlerInstance Create() { State = new DefaultHandlerInstance(new DisposableHandler()); return State; }
public IHandlerInstance Create(Type handlerType) { State = new DefaultHandlerInstance(new DisposableHandler()); return(State); }