Accessing .NETInput node properties at run time
When you add a .NETInput node to a message flow, you can use the User Defined Properties tab of the node to specify properties that can be accessed by the .NET connector code, which implements the logic of the input node at run time.
About this task
The .NET framework provides a class
in the namespace System.Collections.Generic
named Dictionary<TKey,
TValue>
, which represents a collection of keys and their
associated values. When you write code for a .NETInput node, the templates
that are provided in Microsoft Visual Studio helps
you initialize a new instance of the EventInputConnector
or
the PollingInputConnector
class. The template code
includes the definition of the subclass for the EventInputConnector
or PollingInputConnector
class,
which contains a properties parameter, which
is of the data type Dictionary<string,string>
.
This parameter carries user-defined properties for the node, and any
flow-level user-defined properties.
The individual
property names are case-sensitive. For example, you can define a flow-level
user-defined property named property1
, which would
be independent of a .NETInput node User
Defined Property named Property1
. If
you specify a flow-level user-defined property and a .NETInput node user-defined
property with the same name and case, then the value of the .NETInput node property takes
precedence.
The following code snippet demonstrates a simple example:
public PollingInputConnector(NBConnectorFactory connectorFactory, string name, Dictionary<string, string> properties) : base(connectorFactory, name, properties)
{
// Check the Dictionary of user defined properties defined on the node.
// If there is a property named queueName then take its value for use later:
if (properties.ContainsKey("queueName"))
{
queueName = properties["queueName"];
}
}