I Hate appSettings · 18 June, 07:42 PM

I don’t like because it’s unstructured and it’s too easy to jam new configuration values in. Actually, that’s not it. That’s a dumb reason. What I don’t like is that ConfigurationManager is always hanging around, so that arbitrary components can add dependencies on configuration settings that are difficult to keep track of, and difficult to debug on a live box.

It seems to me that a general rule of .NET development should be that only top-level (i.e. executable files or the top level dll of a web project) should be reading . It also seems to me that as a general rule, components should accept their configuration as a parameter (probably to the constructor) and not rely on the execution environment. That’s a simple one. It makes components easier to test because you don’t have to set up an execution enviroment.

— Gordon Weakliem

---

Comment

Commenting is closed for this article.