title: c# SETTINGS architecture
body: <p>I have several applications that need to read and write application settings.  Since one of the apps is a legacy c++ app with hundreds of settings in the registry (and that isn't bound to change) and there are also some settings stored in a proprietary database format I'm wondering how the architecture could be setup to allow a single interface in for reading and or writing the settings.<br>
  One idea is for there to be a giant enum with every possible setting and a split that directs the read/write request, based on a giant case statement, to the correct reader or writer.  In the case of the registry this would then have to further parse the enum possibilities to find the key's location (if its an Http setting its here, if its a Setup setting its located at this key).  This whole idea makes me think non-OOP and too much manual testing.  Keep in mind that there are about 30 DB settings, and maybe 70 registry settings.</p>
  
  <pre><code>public class SettingsTest
  {
      public enum ESetting
      {
          HttpUserName, HttpPassword, SetupAllowPublic,  //db server stored
          HttpProxyUsername, HttpProxyPassword, PublicOrPrivate //registry stored
      }
  
      public string GetSetting(ESetting setting)
      {
          if (IsSettingInRegistry(setting)
              return RegHandler.GetFromRegistry(setting);
          else
              return DBHandler.GetFromDB(setting);
      }
  }
  </code></pre>