GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.servicestack.net — Config API Config APIDespite being avid protesters in the anti-XML config movement, we're still 100% for app Config in general though it should be limited to what's actually configurable by your application. Instead of building tiered configSection manatees we prefer to store structured data in Web.config's appSetting's values which are still able to express rich object config graphs but does so in a much more human-friendly and manageable size. ServiceStack's Configuration APITo this end we provide our own pluggable Configuration API to provide high-level utility methods to read your Web.config's Benefits over XML ConfigBenefits over existing XML Configuration APIs include:
and promotes less-coupling since its only an interface so can easily be swapped to have Plugins source their complex configuration from an different source (e.g. from a central DB) without a rewrite. OpenId providers like the FacebookAuthProvider is an example of Plugins that require multiple configuration settings but remain de-coupled from any one configuration source (e.g. Web.config). Example AppSettings UsageBy default ServiceStack ships with an AppSettings which reads from your Web.Config Here's a quick example show-casing how to use the popular *AppSettings:
Accessing the above appSettings in C#:
Default configuration in codeThe default value support is nice as it allows having workable default options in code whilst still remaining overridable in the Web.config when it needs to. This allows local and test projects to work without duplicating and maintaining and their own Web.config files whilst allowing arbitrary settings to be overridable in different deployment environments. It also allows distributing Stand-alone Console applications like the PocoPower demo but still provide the opportunity to override the settings without recompiling the source, e.g:
Easy to implementDespite being so versatile, it's surprisingly easy to implement a new Configuration Provider, e.g. Here's the entire implementation for DictionarySettings which just needs to implement ISettings as is able to re-use the built-in
On This Page
|
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |