Class ExpressionBuilderGraphExtensions
- Namespace
- Bonsai.Expressions
- Assembly
- Bonsai.Core.dll
Provides a set of static methods for serializing, building and otherwise manipulating expression builder workflows.
public static class ExpressionBuilderGraphExtensions
- Inheritance
-
ExpressionBuilderGraphExtensions
- Inherited Members
Methods
AddDescriptor(ExpressionBuilderGraph, ExpressionBuilderGraphDescriptor)
Adds the contents of the specified graph descriptor to the ExpressionBuilderGraph.
public static void AddDescriptor(this ExpressionBuilderGraph source, ExpressionBuilderGraphDescriptor descriptor)
Parameters
source
ExpressionBuilderGraphThe directed graph on which to add the contents of
descriptor
.descriptor
ExpressionBuilderGraphDescriptorThe 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.
public static InspectBuilder AsInspectBuilder(this ExpressionBuilder builder)
Parameters
builder
ExpressionBuilderThe expression builder instance to decorate.
Returns
- InspectBuilder
An InspectBuilder instance decorating the specified expression builder.
Build(ExpressionBuilder, params 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.
public static Expression Build(this ExpressionBuilder builder, params Expression[] arguments)
Parameters
builder
ExpressionBuilderThe expression builder.
arguments
Expression[]A collection of Expression nodes that represents the input arguments.
Returns
- Expression
An Expression tree node.
Build(ExpressionBuilderGraph)
Generates an expression tree from the specified expression builder workflow.
public static Expression Build(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
Returns
- 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.
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
buildTarget
ExpressionBuilderThe expression builder node up to which the workflow will be evaluated.
Returns
- Expression
An Expression tree representing the evaluation of the expression builder workflow up to the specified
buildTarget
.
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.
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget, IEnumerable<Expression> buildArguments)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
buildTarget
ExpressionBuilderThe expression builder node up to which the workflow will be evaluated.
buildArguments
IEnumerable<Expression>The sequence of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree.
Returns
- Expression
An Expression tree representing the evaluation of the expression builder workflow up to the specified
buildTarget
.
Build(ExpressionBuilderGraph, ExpressionBuilder, params Expression[])
Generates an expression tree from the specified expression builder workflow and array of build arguments, evaluated up to the specified build target.
public static Expression Build(this ExpressionBuilderGraph source, ExpressionBuilder buildTarget, params Expression[] buildArguments)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
buildTarget
ExpressionBuilderThe expression builder node up to which the workflow will be evaluated.
buildArguments
Expression[]The array of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree.
Returns
- Expression
An Expression tree representing the evaluation of the expression builder workflow up to the specified
buildTarget
.
Build(ExpressionBuilderGraph, IEnumerable<Expression>)
Generates an expression tree from the specified expression builder workflow and a sequence of build arguments.
public static Expression Build(this ExpressionBuilderGraph source, IEnumerable<Expression> buildArguments)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
buildArguments
IEnumerable<Expression>The sequence of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree.
Returns
- Expression
An Expression tree representing the evaluation of the full expression builder workflow.
Build(ExpressionBuilderGraph, params Expression[])
Generates an expression tree from the specified expression builder workflow and array of build arguments.
public static Expression Build(this ExpressionBuilderGraph source, params Expression[] buildArguments)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to generate the expression tree.
buildArguments
Expression[]The array of Expression objects to be assigned as workflow input arguments in the context of generating the expression tree.
Returns
- 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.
public static IObservable<Unit> BuildObservable(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to compile.
Returns
- 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.
public static ExpressionBuilderGraph Convert(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, Func<ExpressionBuilder, ExpressionBuilder> selector)
Parameters
source
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>The expression builder workflow to convert.
selector
Func<ExpressionBuilder, ExpressionBuilder>A transform function to apply to each node.
Returns
- 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>, bool)
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.
public static ExpressionBuilderGraph Convert(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, Func<ExpressionBuilder, ExpressionBuilder> selector, bool recurse)
Parameters
source
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>The expression builder workflow to convert.
selector
Func<ExpressionBuilder, ExpressionBuilder>A transform function to apply to each node.
recurse
boolA value indicating whether to recurse the conversion into nested workflows.
Returns
- 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.
public static IEnumerable<ExpressionBuilder> Descendants(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to search.
Returns
- 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.
public static IEnumerable<ExpressionBuilder> Elements(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to search.
Returns
- 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.
public static ExpressionBuilderGraph FromInspectableGraph(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to convert.
Returns
- ExpressionBuilderGraph
A new expression builder workflow where all InspectBuilder nodes have been replaced by their decorated children.
FromInspectableGraph(IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>, bool)
Converts the specified expression builder workflow into an equivalent representation where all the InspectBuilder nodes have been replaced by their decorated children.
public static ExpressionBuilderGraph FromInspectableGraph(this IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> source, bool recurse)
Parameters
source
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>>The expression builder workflow to convert.
recurse
boolA value indicating whether to recurse the conversion into nested workflows.
Returns
- 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.
public static IObservable<Exception> InspectErrorsEx(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to redirect errors.
Returns
- 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.
public static bool IsBuildDependency(this ExpressionBuilder builder)
Parameters
builder
ExpressionBuilderThe ExpressionBuilder to test.
Returns
- bool
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.
public static void SetWorkflowProperty(this ExpressionBuilderGraph source, string name, object value)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow for which to set the property.
name
stringThe name of the workflow property.
value
objectThe new value.
ToDescriptor(ExpressionBuilderGraph)
Converts an expression builder workflow into its serializable representation.
public static ExpressionBuilderGraphDescriptor ToDescriptor(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to convert.
Returns
- 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.
public static ExpressionBuilderGraph ToInspectableGraph(this ExpressionBuilderGraph source)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to convert.
Returns
- ExpressionBuilderGraph
A new expression builder workflow where all nodes have been decorated by InspectBuilder instances.
ToInspectableGraph(ExpressionBuilderGraph, bool)
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.
public static ExpressionBuilderGraph ToInspectableGraph(this ExpressionBuilderGraph source, bool recurse)
Parameters
source
ExpressionBuilderGraphThe expression builder workflow to convert.
recurse
bool
Returns
- 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.