Class ExpressionBuilderGraphExtensions
Provides a set of static methods for serializing, building and otherwise manipulating expression builder workflows.
Inherited Members
Namespace: Bonsai.Expressions
Assembly: Bonsai.Core.dll
Syntax
public static class ExpressionBuilderGraphExtensions
Methods
| Improve this Doc View SourceAddDescriptor(ExpressionBuilderGraph, ExpressionBuilderGraphDescriptor)
Adds the contents of the specified graph descriptor to the ExpressionBuilderGraph.
Declaration
public static void AddDescriptor(this ExpressionBuilderGraph source, ExpressionBuilderGraphDescriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The directed graph on which to add the contents of |
ExpressionBuilderGraphDescriptor | descriptor | The serializable descriptor whose contents should be added to the ExpressionBuilderGraph. |
AsInspectBuilder(ExpressionBuilder)
Decorates the specified expression builder with an InspectBuilder instance allowing for runtime inspection and error redirection.
Declaration
public static InspectBuilder AsInspectBuilder(this ExpressionBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilder | builder | The expression builder instance to decorate. |
Returns
Type | Description |
---|---|
InspectBuilder | An InspectBuilder instance decorating the specified expression builder. |
Build(ExpressionBuilder, Expression[])
Generates an Expression node from a collection of zero or more input arguments. The result can be chained with other builders in a workflow.
Declaration
public static Expression Build(this ExpressionBuilder builder, params Expression[] arguments)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilder | builder | The expression builder. |
Expression[] | arguments | A collection of Expression nodes that represents the input arguments. |
Returns
Type | Description |
---|---|
Expression | An Expression tree node. |
Build(ExpressionBuilderGraph)
Generates an expression tree from the specified expression builder workflow.
Declaration
public static Expression Build(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the full expression builder workflow. |
Build(ExpressionBuilderGraph, ExpressionBuilder)
Generates an expression tree from the specified expression builder workflow evaluated up to the specified build target.
Declaration
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
ExpressionBuilder | buildTarget | The expression builder node up to which the workflow will be evaluated. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the expression
builder workflow up to the specified |
Build(ExpressionBuilderGraph, ExpressionBuilder, IEnumerable<Expression>)
Generates an expression tree from the specified expression builder workflow and a sequence of build arguments, evaluated up to the specified build target.
Declaration
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget, IEnumerable<Expression> buildArguments)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
ExpressionBuilder | buildTarget | The expression builder node up to which the workflow will be evaluated. |
IEnumerable<Expression> | buildArguments | The sequence of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the expression
builder workflow up to the specified |
Build(ExpressionBuilderGraph, ExpressionBuilder, Expression[])
Generates an expression tree from the specified expression builder workflow and array of build arguments, evaluated up to the specified build target.
Declaration
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget, params Expression[] buildArguments)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
ExpressionBuilder | buildTarget | The expression builder node up to which the workflow will be evaluated. |
Expression[] | buildArguments | The array of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the expression
builder workflow up to the specified |
Build(ExpressionBuilderGraph, IEnumerable<Expression>)
Generates an expression tree from the specified expression builder workflow and a sequence of build arguments.
Declaration
public static Expression Build(this ExpressionBuilderGraph source, IEnumerable<Expression> buildArguments)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
IEnumerable<Expression> | buildArguments | The sequence of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the full expression builder workflow. |
Build(ExpressionBuilderGraph, Expression[])
Generates an expression tree from the specified expression builder workflow and array of build arguments.
Declaration
public static Expression Build(this ExpressionBuilderGraph source, params Expression[] buildArguments)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to generate the expression tree. |
Expression[] | buildArguments | The array of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree. |
Returns
Type | Description |
---|---|
Expression | An Expression tree representing the evaluation of the full expression builder workflow. |
BuildObservable(ExpressionBuilderGraph)
Builds and compiles an expression builder workflow into an observable that can be subscribed for its side-effects.
Declaration
public static IObservable<Unit> BuildObservable(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to compile. |
Returns
Type | Description |
---|---|
IObservable<Unit> | An observable sequence with no elements except for termination messages. |
Convert(IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>, Func<ExpressionBuilder, ExpressionBuilder>)
Converts the specified expression builder workflow into an equivalent representation where each node has been replaced by its projection as specified by a selector function.
Declaration
public static ExpressionBuilderGraph Convert(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, Func<ExpressionBuilder, ExpressionBuilder> selector)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> | source | The expression builder workflow to convert. |
Func<ExpressionBuilder, ExpressionBuilder> | selector | A transform function to apply to each node. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A new expression builder workflow where all nodes have been replaced by their projections as specified by the selector function. |
Convert(IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>, Func<ExpressionBuilder, ExpressionBuilder>, Boolean)
Converts the specified expression builder workflow into an equivalent representation where each node has been replaced by its projection as specified by a selector function.
Declaration
public static ExpressionBuilderGraph Convert(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, Func<ExpressionBuilder, ExpressionBuilder> selector, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> | source | The expression builder workflow to convert. |
Func<ExpressionBuilder, ExpressionBuilder> | selector | A transform function to apply to each node. |
Boolean | recurse | A value indicating whether to recurse the conversion into nested workflows. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A new expression builder workflow where all nodes have been replaced by their projections as specified by the selector function. |
Descendants(ExpressionBuilderGraph)
Returns a filtered collection of the descendant elements for this workflow, including elements nested inside grouped workflows. Any descendants of disabled groups will not be included in the result.
Declaration
public static IEnumerable<ExpressionBuilder> Descendants(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to search. |
Returns
Type | Description |
---|---|
IEnumerable<ExpressionBuilder> | An enumerable sequence of all the descendant elements in this workflow. |
Elements(ExpressionBuilderGraph)
Returns a filtered collection of the child elements for this workflow.
Declaration
public static IEnumerable<ExpressionBuilder> Elements(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to search. |
Returns
Type | Description |
---|---|
IEnumerable<ExpressionBuilder> | An enumerable sequence of all the elements in this workflow. |
FromInspectableGraph(ExpressionBuilderGraph)
Converts the specified expression builder workflow into an equivalent representation where all the InspectBuilder nodes have been replaced by their decorated children.
Declaration
public static ExpressionBuilderGraph FromInspectableGraph(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to convert. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A new expression builder workflow where all InspectBuilder nodes have been replaced by their decorated children. |
FromInspectableGraph(IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>, Boolean)
Converts the specified expression builder workflow into an equivalent representation where all the InspectBuilder nodes have been replaced by their decorated children.
Declaration
public static ExpressionBuilderGraph FromInspectableGraph(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> | source | The expression builder workflow to convert. |
Boolean | recurse | A value indicating whether to recurse the conversion into nested workflows. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A new expression builder workflow where all InspectBuilder nodes have been replaced by their decorated children. |
InspectErrorsEx(ExpressionBuilderGraph)
Redirects any build or execution errors signaled by InspectBuilder nodes in the specified expression builder workflow into a single observable sequence.
Declaration
public static IObservable<Exception> InspectErrorsEx(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to redirect errors. |
Returns
Type | Description |
---|---|
IObservable<Exception> | An observable sequence where all elements are errors raised by InspectBuilder nodes. |
IsBuildDependency(ExpressionBuilder)
Determines whether the specified ExpressionBuilder represents a build dependency.
Declaration
public static bool IsBuildDependency(this ExpressionBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilder | builder | The ExpressionBuilder to test. |
Returns
Type | Description |
---|---|
Boolean | true if the specified ExpressionBuilder represents a build dependency; otherwise, false. |
SetWorkflowProperty(ExpressionBuilderGraph, String, Object)
Sets the value of a workflow property to a different value.
Declaration
public static void SetWorkflowProperty(this ExpressionBuilderGraph source, string name, object value)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow for which to set the property. |
String | name | The name of the workflow property. |
Object | value | The new value. |
ToDescriptor(ExpressionBuilderGraph)
Converts an expression builder workflow into its serializable representation.
Declaration
public static ExpressionBuilderGraphDescriptor ToDescriptor(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to convert. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraphDescriptor | The serializable descriptor of the specified expression builder workflow. |
ToInspectableGraph(ExpressionBuilderGraph)
Converts the specified expression builder workflow into an equivalent representation where all the nodes are decorated by InspectBuilder instances that allow for runtime inspection and error redirection of workflow values.
Declaration
public static ExpressionBuilderGraph ToInspectableGraph(this ExpressionBuilderGraph source)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to convert. |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A new expression builder workflow where all nodes have been decorated by InspectBuilder instances. |
ToInspectableGraph(ExpressionBuilderGraph, Boolean)
Converts the specified expression builder workflow into an equivalent representation where all the nodes are decorated by InspectBuilder instances that allow for runtime inspection and error redirection of workflow values.
Declaration
public static ExpressionBuilderGraph ToInspectableGraph(this ExpressionBuilderGraph source, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
ExpressionBuilderGraph | source | The expression builder workflow to convert. |
Boolean | recurse |
Returns
Type | Description |
---|---|
ExpressionBuilderGraph | A value indicating whether to recurse the conversion into nested workflows. A new expression builder workflow where all nodes have been decorated by InspectBuilder instances. |