views:

33

answers:

0

I have a WPF application that loads different client data based on a setting in a random config file on the machine. I use the client ID read from this config file to load data from a different folder within the application. The data includes a Sql compact database, Images, Videos, etc. The content in the application will change based on the Client ID stored in the external config file, allowing for no necessary changes to be made to the application. This works great.

Folder structure -

[Application Root]\Data\[ClientId]\

I now have a requirement to include key/value pairs that are scoped to the client Id and can be in an editable text file. Normally, these settings would sit well in App.config, but because they are Client scoped, they need to sit within the client data directory. My first thought would be to use the configCource attribute of appSettings to point to the correct client setting file, but this needs to happen dynamically and I can't find a way to set this attribute on application startup or programmatically add these settings.

So my question is, how can I programmatically set configSource on appSettings within the App.Config? Or, is there a better method to achieve this?