.NET configuration is great.
But i don't really like working with ConfigurationManager.AppSettings, because i get annoyed:
- that i have to remember key names
- that i may accidentally make typos in the key names, and then spend time looking for it.
I'd rather have a class with all my configuration items presented as properties, so i can enjoy intellisence when reading my app settings.
There are two options here:
- Write a simple wrapper class that reads app settings and provides access to those via properties
- Write a custom configuration provider with would do the same (and even more)
All good, but sometime there's no time to do for any of those. And If you require new app settings (or other configuration items in custom configuration) there's still need to maintain the classes to be able to read those settings.
So, to make life easier, i wrote a simple tool -
ClassFromConfig - that will generate a C# wrapper class from App.config or Web.config. I've registered it in
Visual Studio tools so now it takes only a few seconds to have a fully functional configuration class for accessing those app settings. And if i add more items to my config's app settings? I just re-run the tool.
Anyway, you can download the tool from
http://wiki.webgear.co.nz/ClassFromConfig.ashx and try it for yourself.
Please leave your feedback - i'd love to hear your thoughts!