ISharedConfiguration Interface |
Namespace: VirtualRadar.Interface.Settings
The ISharedConfiguration type exposes the following members.
Name | Description | |
---|---|---|
Singleton |
Gets the single instance of the class that should be used throughout the application.
(Inherited from ISingletonT.) |
Name | Description | |
---|---|---|
ConfigurationChanged |
Raised when the configuration returned by Get has changed.
|
For a long time if you wanted to get the current configuration you had to hook the ConfigurationChanged event on IConfigurationStorage and call Load when the configuration changed. This was fine, it worked, but there were two problems with it:
This class aims to get around these problems. When a configuration value is required a class can call Get. The configuration returned is guaranteed to be current and consistent - if the configuration is changed after Get is called it won't affect the configuration returned by the method.
The drawback is that the configuration is shared. Any changes that you make to the configuration will affect everything using this object. To protect against bugs introduced by this kind of behaviour the object listens for changes to the configuration and throws an exception when they're detected.