Using External Configuration File for Enterprise Library Configuration
One of the things
that I always do when
I’m using Enterprise
Library is to separate
its configurations to
external configuration file.
The reason is very obvious – using Enterprise Library makes
configuration files very crowded. Since this is the case, the
configuration files become unmanageable and then its time to
separate the Enterprise Library’s configurations from other
How to Use external Configuration File for Enterprise Library Configuration?
It is very simple to separate the Enterprise Library configurations
to another external file.
Create a new configuration file in the solution which is going to
hold the Enterprise Library configurations. In my solution I added
a new EL.config file in the root of the project along side for the
Give it a relevant name such as EntLib Configuration Source.
Since my file sits in the root of the project I only have to write
its name and it will be given a relative path. If for example I put it
in a Configuration directory I’ll have to write Configuration/EL.config.
Make the new File Configuration Source the selected source and
that is it.
After doing so all the Enterprise Library configurations
will sit in the file configuration source and not in your web.config
enabling the separation of Ent-Lib configurations from the application
configurations. Also when you’ll open the web.config (or app.config) in
Enterprise Library Configuration Tool it’ll show the Enterprise Library
configurations and enable making changes which will be saved in the
other EL.config automatically for you.
In the post I showed how to separate the Enterprise Library configurations
to external file. This is done to increase manageability of configuration files.