The blog has moved to a new address. The blog is now located at


Friday, August 11, 2006

Why are user scoped settings present in the app.config?

The configuration system is hierarchical and has the following ordering:

Machine à Application à Roaming User à Local User

When you query a configuration section at any level, you get a merged view of the sections declared in that level and those below it (with machine being the lowest level and local user the highest). The section handler defines how the merge happens and for settings, a setting value specified in, say, local user config trumps the one specified in application config.

So for user scoped settings, you can think of the values specified in app.config to be install time defaults. When the settings are saved into user.config, those values will override these defaults. This way admins have the option of changing the defaults. Note that the defaults can also be specified by means of a DefaultSettingValueAttribute. The provider will use this value if no value is specified for a setting in any level of config.

Technorati : ,

No comments: