Adding local environment entries from a .NETInput node
Add information into the local environment by using the connector code for a .NETInput node.
About this task
When developing for a .NETInput node, the content
of the local environment can be populated from within the connector
code for the .NETInput node
as each message is created. The updated local environment allows metadata
about the specific Event or PollingResult to
be stored for use by later nodes in the flow.
The
data is put in a section of the local environment that is called DotNet by
default. Under DotNet in the folder structure is
an Input folder. You can create further folders and
elements under the Input folder.
You can change
the top-level DotNet folder name by setting the Name property
of the factory from within the connectors Constructor(), Initialize() or Start() methods.
You
cannot change the Input folder name.
To create
folders and elements below the Input folder, override
the BuildProperties method on a subclass of NBPollingResult or NBByteArrayPollingResult.
In this method, return a Dictionary that is populated with keys and
values that become Name or NameValue elements
under the Input folder. If the key has multiple parts
that are separated by / characters, then a local
environment tree is created, as shown by the following code examples.
This
code snippet is from a user-defined NBPollingResult subclass:
public override Dictionary<string, string> BuildProperties()
{
var result = new Dictionary<string, string>();
result.Add("a/b/c/d", "Hello");
result.Add("a/e/f", "World!");
return result;
}The previous code results in a Local Environment tree that looks like this:
(0x01000000:Name):DotNet = (
(0x01000000:Name):Input = (
(0x01000000:Name):a = (
(0x01000000:Name):b = (
(0x01000000:Name):c = (
(0x03000000:NameValue):d = 'Hello' (CHARACTER)
)
)
(0x01000000:Name):e = (
(0x03000000:NameValue):f = 'World!' (CHARACTER)
)
)
)
) The next code snippet shows how to change the
name of the top-level DotNet folder to the example
name MyConnectorFactory:
public override void Initialize()
{
NBConnectorFactory factory = ConnectorFactory;
factory.Name = "MyConnectorFactory";
//Other code here. }