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); } }
public override string ToString() { var sb = new StringBuilder(); sb.AppendFormat("\tservice - {0} >>>\n", Uuid.ToString("X4")); sb.AppendFormat("\t\tUuid:{0}\n", Uuid.ToString("X4")); sb.AppendFormat("\t\tStartHandle:{0}\n", StartHandle.ToString("X4")); sb.AppendFormat("\t\tEndHandle:{0}\n\n", EndHandle.ToString("X4")); sb.AppendFormat("\t\tcharacteristics - {0} >>>\n\n", NCharacters); foreach (var character in Characteristics) { sb.Append(character.Value); } sb.AppendFormat("\t\tcharacteristics - {0} <<<\n", NCharacters); sb.AppendFormat("\tservice - {0} <<<\n\n", Uuid.ToString("X4")); return(sb.ToString()); }
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); } }