Open Closed

Abp Setting #353


0
hans abelshausen created

Hi, could you please explain the abp setting table. I have filled the db table with content. Is it necessary to add these content in application settingprovider what I have done. If I started my app a few times and then try to add another setting in the db, the ID increments but not to the next number instead of for example from 3 to 10. I don't know why or haven't understood the settingmanager :-( Here in my application layer:

public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
        {
            return new[]
                   {
                       new SettingDefinition(
                           "FunctionShowShortField", 
                           "true",
                           scopes: SettingScopes.Application, 
                           isVisibleToClients: true),
                        new SettingDefinition(
                           "ProcEditOnlyDraft", 
                           "true",
                           scopes: SettingScopes.Application, 
                           isVisibleToClients: true)
                   };
        }

I wolud like to handle the values of the db table in my angular controller. (abp.setting.get("FunctionShowShortField"))


1 Answer(s)
  • 0
    hikalkan created
    Support Team

    I haven't understood much what you're trying, but I will try to help.

    First of all, if database Id does not increment by one, that's not ABP's problem, it's just SQL server :) And not related to ABP's setting system since ABP does not know Ids.

    You should not add some settings to database without defining it. For example, if your ProcEditOnlyDraft setting is not defined in the code, no meaning to add to database. Database table just stores setting's value, not the definition.

    Also, normally you should not add to settings table manually. Always use ISettingManager.Change... methods (see document: <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Setting-Management">http://www.aspnetboilerplate.com/Pages/ ... Management</a>). But if you want to add by hand, AbpSettings table's fields are simple. If you did not understand a field, I can explain it.