views:

226

answers:

2

I have solution containing silverlight project, wcf service project and other projects of C# i want to have one app settings file from where all projects can load settings. Which will be useful in case of db interaction, logging etc.. Currently i m changing all app settings file in all projects.

A: 

I have used Nini successfully for some time now. It allows you to put all your config settings in a central file which can then be referenced from all your server-side projects, be it web applications, scheduled jobs, wcf services etc. For the Silverlight client apps, I created a WCF configuration service. All the different Silverlight apps access this service at startup to load their settings. This means that the server-side apps only need to know the location of the Nini configuration file, and the Silverlight clients only need to know the url to the configuration service (transferred through the in the .aspx page). The configuration service then accesses the Nini config file and returns a collection of ConfigurationSettingEntity objects. These just contain a key and a value. Of course it is of extreme importance to make sure that all sensitive settings (e.g. db connection strings) are never transferred over the configuration service. Nini allows you to divide your config file into sections. I have three sections currently. One for the Silverlight clients ("ClientSettings"), one for server-side settings only ("ServerSettings") and one that contains any shared settings ("CommonSettings"). This way you can make sure that the configuration service never returns anything from the ServerSettings section. This has worked really well for my purposes.

Henrik Söderlund