How do I supply extra info to IApplicationSettingsProvider class?

Posted by joebeazelman on Stack Overflow See other posts from Stack Overflow or by joebeazelman
Published on 2010-04-30T18:56:39Z Indexed on 2010/05/02 2:17 UTC
Read the original article Hit count: 319

Perhaps this question has been asked before in a different way, but I haven’t been able to find it.

I have one or more plugin adapter assemblies in my application all having the type IPlugin, for instance. Each adapter has its own settings structures stored in a common directory. Whether they are stored in one contiguous file or in separate ones doesn’t matter. Each adapter can have one or more settings associated with it. The settings will have both a name and the Plugin it will be used for.
How would I create such a configuration system using the following requirements:

  1. I want to use .NETs built in settings system and avoid writing one from scratch
  2. The host application will be responsible for locating the plugin settings and passing it to the plugin
  3. Each plugin will be responsible for reading and writing its own settings to separate concerns. The host application should call Plugin.Save(thePath) and it does its thing.
  4. All settings are user scoped

So far, I realize that I would need to write my own SettingsProvider, but the provider seems to work in isolation in that there’s no way to pass it parameters such as the path of the plugin directory and the name of the settings. All of the example code I've seen has the provider getting the data from the runtime environment.

© Stack Overflow or respective owner

Related posts about appsettings

Related posts about user-settings