title: Understanding how Nop Commerce settings are loaded from the database
body: <p>I am working with <code>Nop Commerce</code> and wondering if someone can please help me with my confusion.</p>
  
  <p>I have debugged the code many times trying to find out how the settings are loaded on start up of the web application.  I just don't get it!</p>
  
  <p>All settings classes implement the <code>ISettings</code> interface.  Lets take customer settings for example..  I have found out that it is represented by the <code>CustomerSettings</code> class.  In the database there is a <code>Setting table</code>.  Data for customer settings looks somethng like this:</p>
  
  <pre><code>customersettings.usernamesenabled
  customersettings.checkusernameavailabilityenabled
  customersettings.allowuserstochangeusernames
  ... and so on...
  </code></pre>
  
  <p>How and where are each of these settings mapped from <code>customersettings</code> to the <code>CustomerSettings</code> class and a property like <code>usernamesenabled</code> mapped to the <code>UsernamesEnabled</code> property in the CustomerSettings class?  And why was it implemented this way?</p>
  
  <p>I know it has something to do with the following code in the <code>DependencyRegistrar</code> class:</p>
  
  <pre><code>builder.RegisterGeneric(typeof(ConfigurationProvider&lt;&gt;)).As(typeof(IConfigurationProvider&lt;&gt;));
  builder.RegisterSource(new SettingsSource());
  </code></pre>
  
  <p>If someone can point me in the right direction then it would be appreciated.</p>