Today I had to develop a small snippet on how to configure enterprise library without going through the application xml configuration system. This gave me the idea of creating a new configuration source that works in memory without the need for xml files.
The component described in this article implements convention over configuration for enterprise library.
Convention over Configuration implementation
First I created a static class to hold the convention values. That is the values for the configuration options that are used if nothing else is said:
In this initial version one must override the values in the convention class before asking objects to the factory. I added improving this to the backlog to make a first quick release.
Using the extensions
To get objects use another static class name Factories. This class will have one property per supported block holding the concrete factory. For now the caching application block is supported.
I think a good way to express how to use a library is showing some short unit tests. So to get the default manager write something like this:
And if one wants a named manager, so that it can get different instances to separate information:
I plan to add support to the remaining blocks in a near future. The library is distributed under LGPL. I am thinking on using a strong signature in the next release but I need to put in place a way to take out my key file out of the source release :).
Ready to try it? Get it: