# Connection strings and ConfigurationWrapper

Published On

I always forget how to properly do these damn things :). Everytime I need to use a connection string, I say to myself

Go ahead, do it instead of looking on the web, you have done it millions of times, it will go faster

And no.

It doesn’t go faster. :) I always forget one small thing and then I lose a considerable amount of time fixing the problem. So here it is , one single place for me to look for the information.

# App.config

Check also The Connection Strings Reference , an absolute life saver.

# Why I would need the ConfigurationWrapper ?

ConfigurationWrapper class :

• avoids me to put hard codes code like the following

in my classes

• lets me to mock the interface IConfigurationWrapper during unit tests. This way, I don’t copy or reference app.config in my test classes.

# How to consume ConfigurationWrapper ?

This type can be consumed by injecting it through the constructor.

Tags:   .net   c#   programming   t.d.d   unit test   xml