.NET SettingsProvider/ApplicationSettingsBase caching

Posted by Andy White on Stack Overflow See other posts from Stack Overflow or by Andy White
Published on 2010-01-12T17:01:17Z Indexed on 2010/06/06 16:22 UTC
Read the original article Hit count: 313

I'm looking at some code that uses the .NET System.Configuration.SettingsProvider and ApplicationSettingsBase to handle configuration.

We have a class that derives from SettingsProvider that uses a database as the data store, and then we have other settings classes that inherit from ApplicationSettingsBase, and have the [SettingsProvider(typeof(MySettingsProvider))] attribute.

The problem is that we're using these settings classes in multiple applications, but they seem to permanently cache the configuration values, the first time they are loaded. The issue is that if a setting is changed in one application, the other applications will not get the setting until the next restart, because they are cached everywhere.

My question is: is there a way to force the SettingsProvider implementation, or the classes derived from ApplicationSettingsBase to not cache values, and re-query the datastore every time the setting is accessed? A valid answer might be that these classes were not intended to be used in multi-application environments...

© Stack Overflow or respective owner

Related posts about .NET

Related posts about caching