Skip to content

Workflow.cs

Avrigeanu Laurian edited this page Apr 11, 2023 · 1 revision

This code defines a class named Workflow, which inherits from Dictionary<string, object>. This class is part of the Marionette.Workflow namespace.

The Workflow class has the following private fields:

  • _actions: An array of Func<object, object> instances that represent the actions to be executed in the workflow.
  • _isRunning: A boolean that indicates whether the workflow is currently running.
  • _currentAction: An integer that represents the index of the current action in the list of actions.
  • _iterator: An array of objects that represents the items in the current iterator.

The Workflow class has the following public methods:

  • Workflow(): A constructor that initializes the _actions, _isRunning, and _currentAction fields.
  • CreateSequence(Func<object, object>[] actions): A method that creates a sequence of actions to be executed in the workflow. It takes an array of Func<object, object> instances as a parameter and returns an instance of Workflow.
  • JumpTo(string label): A method that jumps to the specified label in the sequence of actions. It takes a label parameter that specifies the label to jump to and returns an instance of Workflow.
  • Execute(): A method that executes the sequence of actions in the workflow. It returns an instance of Workflow.
  • Return<TInterface>(string alias): A generic method that returns the output of the specified action as an instance of the specified interface. It takes an alias parameter that specifies the alias of the action to return the output of.

This class is used to define a workflow that consists of a sequence of actions to be executed in a specific order. The CreateSequence method is used to define the sequence of actions, while the JumpTo method is used to jump to a specific action in the sequence. The Execute method is used to execute the sequence of actions, while the Return method is used to return the output of a specific action in the sequence. The Workflow class inherits from Dictionary<string, object>, allowing it to store the output of each action in the sequence using an alias.

Clone this wiki locally