I am working with Nop Commerce
and wondering if someone can please help me with my confusion.
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!
All settings classes implement the ISettings
interface. Lets take customer settings for example.. I have found out that it is represented by the CustomerSettings
class. In the database there is a Setting table
. Data for customer settings looks somethng like this:
customersettings.usernamesenabled
customersettings.checkusernameavailabilityenabled
customersettings.allowuserstochangeusernames
... and so on...
How and where are each of these settings mapped from customersettings
to the CustomerSettings
class and a property like usernamesenabled
mapped to the UsernamesEnabled
property in the CustomerSettings class? And why was it implemented this way?
I know it has something to do with the following code in the DependencyRegistrar
class:
builder.RegisterGeneric(typeof(ConfigurationProvider<>)).As(typeof(IConfigurationProvider<>));
builder.RegisterSource(new SettingsSource());
If someone can point me in the right direction then it would be appreciated.