
Extend the Application Configuration File #48
Chapter 6, Speed Hacks
|
187
HACK
HACK
#48
Extend the Application Configuration File Hack #48
Use an open source custom tool to add your own configuration sections to
your app.config file.
Custom configuration sections are a valuable tool for storing application-
specific settings. With .NET, you can extend the normal configuration files
and include your own custom configuration sections. Normally, creating
your own custom configuration section involves writing classes and a config-
uration section handler to access your custom settings. There is an easier
and much quicker way to handle the creation of a custom configuration sec-
tion and all the code that you need to work with it.
The open source custom tool, ConfigBuilder, can be used to automatically
generate configuration section handlers, as well as custom objects that can
be used as data containers for the settings.
To use the ConfigBuilder custom tool, you will need to download and run
the installation file from http://workspaces.gotdotnet.com/configbuilder.
Building the Configuration Template
To start using ConfigBuilder, you first need to add a new XML file to your
project. This XML file is called the configuration template file and will be
used to specify the format of your configuration section. This file will then
used to generate the code to access this configuration section. The configu-
ration