Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:53:34+00:00 2026-06-05T01:53:34+00:00

I am working with Nop Commerce and wondering if someone can please help me

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:53:36+00:00Added an answer on June 5, 2026 at 1:53 am

    Hope i’m not late.

    There are only a few relevant points to look at to understand how that structure is created:

    -Nop.Services.Configuration.ConfigurationProvider class
    -Nop.Services.Configuration.ISettingsService interface
    -Nop.Services.Configuration.SettingsService class
    

    The SettingsService only provides functionality to store and retrieve settings from the repositories, and implements some caching functionality.

    The ConfigurationProvider does the actual magic.

    Let’s look at the BuildConfiguration method:

            // get properties we can write to
            var properties = from prop in typeof(TSettings).GetProperties()
                             where prop.CanWrite && prop.CanRead
                             let setting = _settingService.GetSettingByKey<string>(typeof(TSettings).Name + "." + prop.Name)
                             where setting != null
                             where CommonHelper.GetNopCustomTypeConverter(prop.PropertyType).CanConvertFrom(typeof(string))
                             where CommonHelper.GetNopCustomTypeConverter(prop.PropertyType).IsValid(setting)
                             let value = CommonHelper.GetNopCustomTypeConverter(prop.PropertyType).ConvertFromInvariantString(setting)
                             select new { prop, value };
    

    Using reflection, *Settings class (for example, CustomerSettings), are inspected and their properties used to load corresponding settings from the service.

    Then it converts back the value stored as string (you can check the NopCustomTypeConverter to see how the serialization happens) and assign them back to the Setting Entity:

    properties.ToList().ForEach(p => p.prop.SetValue(Settings, p.value, null));

    The other method, SaveSettings(TSettings settings) does the exact opposite, takes a Setting entity and breaks it down, generating keys-value pairs in the form of ClassName+Propertyvalues)

    It was implemented like this because it deploys concepts from IoC, segregation of interfaces, n-tier and other patterns to ensure maintainability (API based componentization, testability ecc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our application is working n NoP commerce and we are trying to integrate payment
working on my code to retrieve lat,long by clicking and it works fine. wondering
I am working on a ecommerce site built on the top of Nop Commerce
I have been working on asp.net mvc3 e-commerce application based on NopCommerce. Recently we
I'm currently working on a problem that involves System.Reflection.Emit code generation. I'm trying to
Working with an undisclosed API, I found a function that can set the number
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
I'm working with IL code now and will need to write by myself in
I am working on some source code these days. In some codes, I find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.