Intrinsic Component Configuration

From OPC Labs Knowledge Base
Jump to navigation Jump to search


The parameters of main QuickOPC components can be configured externally, without a need to write any code for it. See High-Level Intrinsic Configuration for an overview of this mechanism.

Naming Conventions

The key (name) of the configuration section is the full (namespace-qualified) name of the component being configured. For example, parameters for the EasyUAClient component are under the OpcLabs.EasyOpc.UA.EasyUAClient configuration section.

The component parameter name is then the key (name) of the sub-section. For example, the InstanceParameters can be configured under the InstanceParameters sub-section. If the parameter is not an atomic value, but rather a structured object, deeper sub-sections are used as necessary, recursively.

Error Handling

All errors that occur when the components read their parameters using the intrinsic configuration mechanism are silently ignored. This behavior was chosen because the reading of the configuration happens at time that is generally unpredictable to the developers (such as inside the static constructors of the components), and exceptions thrown at unpredictable place would have potential to crash the application. When an error occurs, the configuration may be read just partially.


The JSON and the environment variable configuration providers are available by default on most hosts (including ASP.NET, and .NET console apps), and you can therefore reliably use configurations similar to the examples below "out of the box" with any QuickOPC-based software.

Example: Using the JSON configuration provider

In order to set the default URL of the OPC UA Global Discovery Server (GDS) used by QuickOPC global discovery operations, you can use the following appsettings.json file:

  "OpcLabs.EasyOpc.UA.EasyUAClient": {
    "InstanceParameters": {
      "GdsEndpointDescriptor": {
        "UrlString": "opc.tcp://"

Example: Using the environment variable configuration provider

In order to achieve the same configuration effect as with the JSON example above, you can set the environment variable as follows (the syntax is for Windows, but the provider is available on other systems as well):

set OpcLabs.EasyOpc.UA.EasyUAClient:InstanceParameters:GdsEndpointDescriptor:UrlString="opc.tcp://"

On platforms where the : separator does not work (e.g. Bash), use __ (double underscore) instead.

More examples

See Intrinsic component configuration examples.

Note on Programmatic Component Configuration

The sequence of high-level component configuration evaluation is as follows:

  1. The values are set to their (constant, documented) defaults (both static and instance members).
  2. Intrinsic configuration, if present, is applied (this can involve multiple configuration providers in specific sequence). This affects both the static and instance members of the component.
  3. If the component supports programmatic component configuration, and the code that creates the component specifies a configuration interface, using a constructor designed for IoC (Inversion of Control), the configuration given by the specified interface is applied (this, again, can involve multiple configuration providers in specific sequence). Only instance members of the component can be configured in this way.
  4. The program code can then further modify values of any component parameters.

As you can see, if the programmatic component configuration or settings the parameters through code is used, the initial values (of instance members) that the component will end up using may be different from what you specify using the intrinsic component configuration feature.

Component Support

The intrinsic component configuration feature is supported by following components, and for the data members listed:

AEDialog (affects derived components AEAreaOrSourceDialog, AEAttributeDialog, AECategoryConditionDialog, AECategoryDialog), DADialog (affects derived components DAItemDialog, DAPropertyDialog)
AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
OpcBrowseControl, OpcBrowseDialog
AEClientSelector, DAClientSelector.
UABrowseControl, UABrowseDialog
UADialog (affects derived components UADataDialog, UAEndpointDialog, UAHostAndEndpointDialog)