Applying a Common Configuration Structure for Applications

Microsoft Enterprise Library 5.0

DropDown image DropDownHover image Collapse image Expand image CollapseAll image ExpandAll image Copy image CopyHover image

If you add a configuration source to your application configuration and specify that this configuration source is the parent source, Enterprise Library will read the contents of this configuration source and merge any local configuration settings you have specified with this parent configuration. Effectively, it inherits the shared configuration and then applies the local settings to override any that occur in both configurations. You can use the configuration tool to specify a parent configuration that will be inherited.

To inherit a shared configuration structure and settings from another configuration source

  1. On the taskbar, click Start, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 5.0, point to Enterprise Library Configuration, and then select the version of the configuration editor you require. Alternatively, right-click on a configuration file in Visual Studio Solution Explorer and click Edit Enterprise Library V5 Configuration.
  2. On the Blocks menu click Add Configuration Settings.
  3. In the Sources pane click the plus-sign icon, point to Add Sources and then click the type of configuration source you want to add to the configuration. This is the configuration source from which you will inherit configuration information. In this example, we add a File-based Configuration Source.

  4. Set the properties of the configuration source you added. For example, enter the desired File Path property for the new configuration source by typing the path and file name or by clicking the ellipses (...) button and navigating to the file.

  5. Click the Configuration Sources property expander chevron to open the properties pane for the section. Set the Parent Source property to the configuration source whose settings you want to inherit.

  6. Click Save or Save As on the File menu to save your configuration.

Settings in the inherited configuration source will apply to your application unless you override them by configuring the same setting in your local configuration. For information about how settings are inherited and merged, see Merge Rules for Inherited Configuration.