In a .NET application, if you have specific Settings need, such as storing them in DB, then you could replace LocalFileSettingsProvider
with a custom settings provider of your, examples:
Create a Custom Settings Provider to Share Settings Between Applications
Creating a Custom Settings Provider
To declare the settings class (the one that inherits ApplicationSettingsBase
) that you want to use a specific provider, you decorate it with SettingsProviderAttribute
and pass your provider type as a parameter [SettingsProvider(typeof(MyCustomProvider))]
, otherwise it will use the default LocalFileSettingsProvider
.
My question: Is there a configuration or a trick I could use to force my application to use my custom provider through-out the application without using an attribute?
The reason is that I am loading plugins via MEF and the plugins might be written via 3rd party and I don't want them to be concerned with how settings are being dealt with.