Table of Contents

Class PropertyMappingBuilder

Namespace
Bonsai.Expressions
Assembly
Bonsai.Core.dll

Represents an expression builder that assigns values of an observable sequence to properties of a workflow element.

The connection between the property mapping and its target node only affects the state of properties. The behaviour of the operator will otherwise remain unaffected, since the subscription to the mapping is not considered as a proper upstream source. This is indicated in the editor by the dashed line linking the property mapping operator to its target.

Warning

Because property values are updated independently, this means that values can change even while the target operator is reacting to notifications from other nodes. Care must be taken to ensure that changing the property state in this way does not break the behaviour of the workflow.

Specifically, some operators respond to changes in their parameters only at specific moments. For example, the parameters of the Timer operator must be set before the observable sequence is initialized. In this case, the input to the externalized property needs to be emitted immediately during the subscription phase for the mapping to work.

Multiple properties can be mapped simultaneously from the same source sequence when using PropertyMapping. You can select which properties to map by using the editors available in the property grid. For each mapped property you must specify a source selector, i.e. an expression specifying which members of the input data type are used to assign values to the mapped property.

Note

If the type of the selected member does not match the type of the property, a conversion is attempted. If no compatible conversion is available, the compiler checks whether it is possible to construct the corresponding data type from the selected members. For example, it would be possible to map to a Point type by selecting two numeric values from the source sequence. In this case, the values would be used to construct a new point instance by assigning them to the X and Y parameters of the type constructor.

In each property mapping operator, all mapped properties are updated at the same time every time the source sequence sends out a new value. It is also possible to connect property mapping operators to multiple target nodes.

[WorkflowElementCategory(ElementCategory.Property)]
public class PropertyMappingBuilder : SingleArgumentExpressionBuilder, IExpressionBuilder, INamedElement
Inheritance
PropertyMappingBuilder
Implements
Derived
Inherited Members
Extension Methods

Properties

PropertyMappings

Gets a collection of property mappings that specify how input values are assigned to properties of the workflow element.

public PropertyMappingCollection PropertyMappings { get; }

Property Value

PropertyMappingCollection

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.