/// <summary> /// Access completed result of child workflow as dynamic object. If completed result is JSON object then you can directly access its properties. /// Throws exception when last event is not <see cref="ChildWorkflowCompletedEvent"/>. /// </summary> /// <param name="item"></param> /// <returns></returns> public static dynamic Result(this IChildWorkflowItem item) { Ensure.NotNull(item, nameof(item)); var completedEvent = item.LastEvent() as ChildWorkflowCompletedEvent; if (completedEvent == null) { throw new InvalidOperationException(Resources.ChildWorkflow_result_can_not_be_accessed); } return(completedEvent.Result()); }
/// <summary> /// Retruns the <see cref="ChildWorkflowFailedEvent"/> and if it is the last event, otherwise null is returned. /// </summary> /// <param name="item"></param> /// <returns></returns> public static ChildWorkflowFailedEvent LastFailedEvent(this IChildWorkflowItem item) { Ensure.NotNull(item, nameof(item)); return(item.LastEvent() as ChildWorkflowFailedEvent); }
/// <summary> /// Returns true if last event of child workflow is <see cref="ChildWorkflowCancelledEvent"/> /// </summary> /// <param name="item"></param> /// <returns></returns> public static bool HasCancelled(this IChildWorkflowItem item) { Ensure.NotNull(item, nameof(item)); return(item.LastEvent() is ChildWorkflowCancelledEvent); }
private string WorkflowInput(IChildWorkflowItem item) { var lastEvent = item.LastEvent() as ChildWorkflowEvent; return(lastEvent != null ? lastEvent.Input : StartedEvent.Input); }