Intrinsic Component Configuration: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Configuration]] [[Category:High-Level Configuration]] [[Category:OpcCmd Utility]] | [[Category:Configuration]] [[Category:High-Level Configuration]] [[Category:OpcCmd Utility]] | ||
= Introduction = | = Introduction = | ||
= Naming Conventions = | = Naming Conventions = | ||
Line 14: | Line 6: | ||
The component parameter name is then the key (name) of the sub-section. For example, the {{Style=Identifier|InstanceParameters}} can be configured under the <code>InstanceParameters</code> sub-section. If the parameter is not an atomic value, but rather a structured object, deeper sub-sections are used as necessary, recursively. | The component parameter name is then the key (name) of the sub-section. For example, the {{Style=Identifier|InstanceParameters}} can be configured under the <code>InstanceParameters</code> sub-section. If the parameter is not an atomic value, but rather a structured object, deeper sub-sections are used as necessary, recursively. | ||
= Examples = | = Examples = | ||
Line 47: | Line 36: | ||
# The program code can then further modify values of any component parameters. | # 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 implicit component configuration feature. | 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 implicit component configuration feature. | ||
= Component Support = | = Component Support = | ||
The implicit component configuration feature is supported by following components, and for the data members listed: | The implicit component configuration feature is supported by following components, and for the data members listed: |
Revision as of 20:18, 3 February 2021
Introduction
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.
Examples
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://opcua.demo-this.com:58810/GlobalDiscoveryServer"
}
}
}
}
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://opcua.demo-this.com:58810/GlobalDiscoveryServer"
On platforms where the :
separator does not work (e.g. Bash), use __
(double underscore) instead.
Note on Programmatic Component Configuration
The sequence of high-level component configuration evaluation is as follows:
- The values are set to their (constant, documented) defaults (both static and instance members).
- Implicit 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.
- 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.
- 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 implicit component configuration feature.
Component Support
The implicit component configuration feature is supported by following components, and for the data members listed:
- EasyAEClient
- AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
- EasyDAClient
- AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
- EasyUAClient
- AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.
- EasyUASubscriber
- AdaptableParameters, SharedParameters, InstanceParameters, IsolatedParameters.