Class IncludeWorkflowBuilder
- Namespace
- Bonsai.Expressions
- Assembly
- Bonsai.Core.dll
Represents an expression builder that uses an encapsulated workflow stored externally to generate its output.
The IncludeWorkflow
operator works in exactly the same way as GroupWorkflow, with the difference that the nested workflow definition is stored externally in a file, rather than locally in the node itself. Include nodes are used to organize larger workflows into modular building blocks. They allow reusing functionality across different parts of a workflow, or even across different projects. Changing the definition of an included workflow will be automatically reflected in all places where that workflow is reused.
All observable sequences passed as arguments to the outer IncludeWorkflow
will be routed to the inner WorkflowInput nodes. Conversely, all notifications emitted by the sequence connected to the single WorkflowOutput node will be passed to any observers of the include workflow node. It is possible to subscribe multiple times to the same include workflow, in which case the nested workflow will run potentially in parallel and is considered to be reentrant.
Note
Externalized properties contained inside the included workflow will be exposed when selecting the IncludeWorkflow
node. Any changes to the values of these properties can be recovered, even if the included workflow is reused multiple times in different parts of the program. They can also be further externalized as part of other nested operators or dynamically assigned using PropertyMapping or InputMapping operators.
Warning
If the nested workflow is reentrant, properties of inner nodes are shared by all asynchronous operations which are running simultaneously. If the shared state never changes across reentrant operations (i.e. the state is immutable), this is not a problem. If shared state is changing dynamically, you should consider using synchronization primitives to make sure that state updates are coordinated across the different asynchronous operations.
[WorkflowElementCategory(ElementCategory.Workflow)]
public sealed class IncludeWorkflowBuilder : VariableArgumentExpressionBuilder, IWorkflowExpressionBuilder, IExpressionBuilder, INamedElement
- Inheritance
-
IncludeWorkflowBuilder
- Implements
- Inherited Members
- Extension Methods
Constructors
IncludeWorkflowBuilder()
Initializes a new instance of the IncludeWorkflowBuilder class.
public IncludeWorkflowBuilder()
Properties
ArgumentRange
Gets the range of input arguments the included workflow accepts.
public override Range<int> ArgumentRange { get; }
Property Value
Description
Gets a description for the included workflow.
[Browsable(false)]
public string Description { get; }
Property Value
Name
Gets the name of the included workflow.
[Browsable(false)]
public string Name { get; }
Property Value
Path
Gets or sets the path of the workflow to include.
[Externalizable(false)]
[FileNameFilter("Bonsai Files (*.bonsai)|*.bonsai")]
public string Path { get; set; }
Property Value
PropertiesXml
Gets or sets the XML representation of externalized property values from the included workflow.
[Browsable(false)]
public XElement[] PropertiesXml { get; set; }
Property Value
- XElement[]
Workflow
Gets the expression builder workflow that will be used to generate the output expression tree.
[Browsable(false)]
public ExpressionBuilderGraph Workflow { get; }
Property Value
Methods
Build(IEnumerable<Expression>)
Generates an Expression node from a collection of input arguments. The result can be chained with other builders in a workflow.
public override Expression Build(IEnumerable<Expression> arguments)
Parameters
arguments
IEnumerable<Expression>A collection of Expression nodes that represents the input arguments.
Returns
- Expression
An Expression tree node.