Home > ConfigurableAppSettings

ConfigurableAppSettings

ConfigurableAppSettings is a project mainly written in JAVASCRIPT and C#, it's free.

A portable implementation of application settings that are strongly typed and can be overridden by app.config or web.config settings. Based on Joshua Flanagan's blog post: http://lostechies.com/joshuaflanagan/2009/07/13/how-we-handle-applica

ConfigurableAppSettings is a standalone assembly that you can drop into your project to implement the core functionality described by Joshua Flanagan in his post How we handle application configuration.

Included here is an extensible implementation with a supporting ConfigurableAppSettings.StructureMap assembly that extends the core functionality with StructureMap support.

My intention was to abstract this in such a way that:

  1. it could be dropped into any app, either manually or as a nuget package; and
  2. it could be used with any IoC container that supports the Enrich pattern of interception.

This project includes a sample MVC3 app using the core project and the StructureMap extension. Change (or remove) the SampleSettings.Greeting AppSetting entry in the web project's web.config to see that you can override this setting or revert back to the hard-coded default value all without recompiling the app. This works great with VS2010's web.config transformations as we are using it in production where we can feed different SMTP settings into our app by stashing them in web.config.Debug, web.config.Stage, & web.config.Release.

Currently, ConfigurableAppSettings supports the following containers:

  • StructureMap

If you know of another IoC container that can run an arbitrary lambda against a newly created object before it gets passed to any consumers (i.e. the equivalent of StructureMap's EnrichWith interception), please let me know. Or, fork the code and contribute a patch.

Previous:BringTheFood