MS Patterns & Practices: Configuration Application Block

Since I’ve been playing with the Logging Block, I figured I’d look at the Configuration Block as well, and to be honest I’m dissappointed, almost as dissappointed as discovering that the .NET System.Configuration namespace doesn’t have a configuration persistence layer!

I think it should be renamed the “Object Serialisation Abstraction Block” since thats all it is, it has little to do with configuration in the traditional sense.

If your applications configuration can be packaged in to 1 or more serialisable objects, then maybe, you might use it for that but otherwise forget it. But perhaps the major “flaw” is the fact that configuration sections, as they’re known, are written in their entirety. Meaning that a configuration section can only be used to store configuration data for a single object (single object serialisation). As far as I can tell, if you want to use a single configuration section (and hence configuration .config file) you have to have a serialisable object which represents all this configuration.

However, it does allow you to write your own Transformers and Storage Providers, so your could persist configuration data any way you like, but like I said, this is more akin to a Serialisation Abstraction Layer, and if you view it that way, then, it’s very good at that.

But, in its favour, if it does fit your configuration needs, then its very easy to setup, in no more than a few minutes.

Published by

Phil Harding

SharePoint Consultant, Developer, Father, Husband and Climber.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.