Fork me on GitHub

Configuration sections

The bootstrapper supports loading of configuration sections through behaviors. The behaviors responsible for loading configuration sections must be applied in the begin section of the run syntax.

ConfigurationSection

To be able to load configuration sections the ConfigurationSectionBehavior must be added in the strategy.

Furthermore for each extension which needs access to a configuration section there must be a configuration section definition in the application configuration file. By convention the section name must be the class name of the extension which consumes the configuration section. The convention can be controlled by implementing a set of interfaces which is described in the customization section.

The extension which wants to receive the loaded configuration section must implement IConsumeConfigurationSection.

ExtensionConfigurationSection

To be able to load extension configuration sections the ExtensionConfigurationSectionBehavior must be added in the strategy.

Furthermore for each extension which needs access to an extension configuration section there must be an extension configuration section definition in the application configuration file. By convention the section name must be the class name of the extension which consumes the extension configuration section. The convention can be controlled by implementing a set of interfaces which is described in the customization section.

The corresponding extension can now simply declare properties with names matching the keys in the configuration dictionary. The behavior automatically fills the properties with the values found in the configuration dictionary. The bootstrapper tries to automatically convert the values found in the dictionary to the target property type by using System.Convert.ChangeType. When complex conversions need to be done it can be customized according to the description in the customization section. Note: The properties must have an accessible setter.

It is also possible to directly consume the configuration dictionary. Simply declare the extension configuration section

The extension must implement IConsumeConfiguration. The Configuration property must return a dictionary which will be filled with the keys and values found in the corresponding extension configuration section.