How do I contact my custom preferences provider?

I need to specify a different location for my settings file. After hours of searching, I found out that I have to write my own SettingsProvider. I was able to create one that allows me to specify the path for the settings file through its constructor. Programmatically, I can do it like this:

var mycustomprovider = new CustomSettingsProvider (path);

The problem I am facing is that there is no way to call my custom provider. I can decorate the generated VS 2008 settings file with the following attribute:

[SettingsProvider(typeof(CustomSettingProviders.CustomSettingsProvider))]
internal sealed partial class Settings {
}

      

However, the attribute prevents me from constructing an object using a path. Also, I want to be able to set the SettingsProvider programmatically so that I can pass any path at runtime and save my settings. The examples I've seen on the web have never mentioned how to programmatically call with the SetupProvider program.

+2


a source to share


1 answer


I asked a similar question with the same solution: How do I add additional information to the IApplicationSettingsProvider class?



+1


a source







All Articles