Applications may have a choice of settings storages. In such cases it may be best to use an application specific implementation of ISettingsStorage as a proxy. The proxy would then access the appropriate storage. This demo shows how simple it it to make such a proxy.
It cheats! It pretends to be a client that loads settings from a local file called "Client.xml". When the user "connects to the server" by checking the check box, it pretends to fetch the settings from the server, actially the file "Server.xml".
The Storage object is of type TStorageProxy which is defined in the Demo5Settings unit.
TStorageProxy creates an aggregate of type TXMLSettingsStorage. It is used to convert the settings to and from XML. This XML is then fetched or sent to the server or client depending on whether IsConnected is true or not.
The Storage variable can be replaced anytime with a different ISettingsStorage implementation without affecting the rest of the application.