Using the Configuration Tools
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Enterprise Library information can be found at the Enterprise Library site. |
The Enterprise Library configuration tools are graphical tools that allow you to create, change, and validate application block settings without having to manually edit the XML configuration files where they are stored. There are two tools to choose from: the Configuration Editor, which is integrated with Visual Studio, and the Configuration Console, which is a stand-alone tool. These tools display the available configuration settings, the default values that you can change, and information about what each setting means.
To use the Visual Studio Configuration Editor
- Open a solution in Visual Studio on a computer where you have installed Enterprise Library.
- In Solution Explorer, right-click the configuration file, and then click Edit Enterprise Library Configuration.
- Right-click Application Configuration node, point to New, and then click an application block in the list. For example, click Logging Application Block.
- The configuration options for that application block display, along with their default values. Right-click and change the configuration options as required. For example, if you are configuring the Logging Application Block and you want to add a flat file trace listener, do the following:
- Right-click Trace Listeners, point to New, and then click FlatFile TraceListener.
- In the Properties pane next to the FileName property, click the ellipsis button (...), select the target folder for the file, and enter a file name for the trace listener file.
- After you make all your configuration changes, click Save on the File menu.
In Visual Studio, the XML Editor is the default editor for .config files. When you double-click a .config file in Solution Explorer, the XML Editor opens. The following procedure describes how to change the default editor.
To set the Visual Studio Configuration Editor as the default editor
- Open a project in Visual Studio.
- In Solution Explorer, right-click a configuration (.config) file.
- Click Open With.
- Click Enterprise Library Configuration Editor.
- Click the Set as Default button.
- Click OK.
To use the Enterprise Library Configuration Console
On the taskbar, click Start, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 4.1 — October 2008, and then click Enterprise Library Configuration. This loads the copy of the Configuration Console that uses the strong-named assemblies. If you are using a different set of assemblies, navigate to the appropriate copy of EntLibConfig.exe using Windows Explorer.
On the File menu, click New Application (if you are configuring a new application) or Open Application (if you are configuring an existing application).
Note
When you open an existing application configuration file, the Configuration Console displays the Data Access Application Block if your Machine.config file contains any connection strings. For more information, see Configuration Tool Usage Notes.
Right-click Application Configuration node, point to New, and then click an application block in the list. For example, click the Logging Application Block.
The configuration options for that application block display, along with their default values. Right-click and change the configuration options as required. For example, if you are configuring the Logging Application Block and you want to add a flat file trace listener, do the following:
- Right-click Trace Listeners, point to New, and then click FlatFile TraceListener.
- In the Properties pane next to the FileName property, click the ellipsis button (...), select the target folder for the file, and enter a file name for the trace listener file.
After you make all your configuration changes, click Save Application on the File menu.
The documentation for each application block contains procedures for configuring it.
Type Selector Tool
The Type Selector tool is a part of the Enterprise Library Configuration tool. It enables you to select from a list of classes. You can also choose the assembly to load. The Type Selector has the following features:
- Ability to filter types. As you type in the Filter text box, the non-matching types are removed from the tree listing assemblies. Ctrl-L is the shortcut to display the Filter text box.
- Ability to load assemblies from the Global Assembly Cache (GAC). Ctrl-G is the shortcut for this feature. There is no filter in the dialog box for picking the assembly from the GAC, but you can type the assembly name when the list has focus. The list has focus by default.
- Ability to specify closed generic types. You can define a closed generic type by choosing the generic type and its parameters in the Type Building Tree at the top of the window. The parameters can be generics, so the tree can get arbitrarily deep.
The way you open the Type Selector tool is usage dependent. You access it either from in the property section of the properties pane, in which case you click the ellipsis button (…); or by right clicking on an item in the left pane of the Enterprise Library Configuration Tool, then click on New and then click on Type.
To use the Type Selector tool to select a type
- Open the Type Selector tool.
- In the Type Selector — System.Object dialog box, expand the assembly you want to use.
- Filter the list. In the Filter edit box type the string to use to filter the list. For example type "string" to filter for all classes containing the word "string".
- If the desired assembly is not in the dialog box, click Load from File or Load from GAC and navigate to it.
- In Type Selector — System.Object dialog box click on the type you want.
- To accept the selection click the OK button.
Configuration Tool Usage Notes
Here are some additional points about the configuration tools:
- The configuration tools do not support editing or storing Enterprise Library configuration sections in the Machine.config file. Enterprise Library configuration section information in the Machine.config file can be accessed at run-time, but it cannot be modified at design-time. Therefore, you should not store Enterprise Library configuration information in the Machine.config file.
- The configuration tools display connection strings stored in the Machine.config file, but they only save connection strings in the application configuration file. If you use the configuration tools to modify connection strings stored in the Machine.config file, the changes will be lost.
- At run-time, the Data Access Application Block can use connection strings that are defined in the Machine.config file.
- The configuration tools display connection string information under the Data Access Application Block configuration information. This means that, if there are connection strings defined in the Machine.config file, you will see the Data Access Application Block node when you open any application configuration file, regardless of whether you added the application block to your configuration file.
- If your application configuration includes a custom provider, you must make the custom provider assembly available to the Enterprise Library Configuration Console. To do this, you can copy the assembly to the same directory as the Configuration Console executable or install it in the global assembly cache. You can also use the DEVPATH environment variable to allow the Configuration Console to locate the custom provider assembly.
- The <appSettings> sections must be included in a single file and not distributed across multiple files. Examples of files that you cannot edit include the Machine.config file and <appSettings> sections that include the optional file attribute that specifies a relative path to an external configuration file.