Using external config file with EntLib 2.0

Configuring application blocks in entlib as an external source was supported out of the box in entlib 1.1, by that I mean, you could add an application block configuration using the tool and it showed up as an external file. However, this is not the case with 2.0. When the configuration is saved it is written to web.config/app.config. If you are like me who likes to sepearte out different configurations then there are few ways to get around this. First and the simplest is using the configSource attribute supported by .Net Framework.

<

<

</

<

configSections>section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary
.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />configSections>loggingConfiguration configSource="logger.config"/>

However, one pitfall with this is while using the tool to edit the configuration, though it is read corrrectly, when saving it, it writes to web.config/app.config again. So, you'll end up manually cleaning it (Not my favorite thing to do). You can get around this by using enterpriselibary's configurationSource as in 1.1. Tom Hollander has a great blog on this. Check it out.

Print | posted on Monday, September 25, 2006 8:54 PM

Feedback

No comments posted yet.

Your comment:





 
Please add 5 and 4 and type the answer here:

Copyright © Bigyan Rajbhandari