Base solution for your next web application
Open Closed

Default settings #4774


User avatar
0
antonis created

Hi

I want to change some pre-installed settings like security settings because I am planning to remove the angular components for it and dont give the user the chance to be able to change this.

How can I change this settings and set the values in database (or where they are stored)? I am using asp.net core and angular 2.

Thanks.


10 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Here is how the related settings are retrieved <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application/Configuration/Tenants/TenantSettingsAppService.cs#L156">https://github.com/aspnetzero/aspnet-ze ... ce.cs#L156</a>.

    So, you can store them in DB using related setting names.

  • User Avatar
    0
    antonis created

    Hi,

    In which table they are stored in? I dont see any settings in a clean installation.

  • User Avatar
    0
    alper created
    Support Team

    hi,

    All the settings are stored in AbpSettings table. But if a setting is in default value then it's not saved in AbpSetting table. You can only see modified values in AbpSettings table. If you want to override setting values you can seed the DB or insert manually. Then application will read your settings from table.

  • User Avatar
    0
    antonis created

    Hi,

    Where are default values stored?

    Also can you point on where the seed is done?

    Thanks

  • User Avatar
    0
    alper created
    Support Team

    hi,

    You can use GetAllSettingValuesAsyncin ISettingManagerclass. <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Configuration/ISettingManager.cs#L92">https://github.com/aspnetboilerplate/as ... ger.cs#L92</a>

    You can seed DB in EntityFrameworkCoreproject. Use SeedHelper's SeedHostDbmethod to insert into AbpSettingstable.

  • User Avatar
    0
    antonis created

    Hi,

    The question is where are these settings (default) are stored not how to get them. I cannot debug the code because is using AbpBoilerplate dll.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    @antonis default setting values are not stored in database. They are defined with the setting itself in the code. The setting values in the database overrides default values defined in the code.

    That's why I suggested to insert values to the database (AbpSettigs table) for changing setting defaults. This is an example setting with a default value <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Timing/TimingSettingProvider.cs">https://github.com/aspnetboilerplate/as ... rovider.cs</a>.

  • User Avatar
    0
    aaron created
    Support Team

    <cite>ismcagdas: </cite> This is an example setting with a default value TimingSettingProvider.cs.

    @antonis As for security settings, they are in AbpZeroSettingProvider.cs.

  • User Avatar
    0
    antonis created

    <cite>ismcagdas: </cite> @antonis default setting values are not stored in database. They are defined with the setting itself in the code. The setting values in the database overrides default values defined in the code.

    That's why I suggested to insert values to the database (AbpSettigs table) for changing setting defaults. This is an example setting with a default value <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Timing/TimingSettingProvider.cs">https://github.com/aspnetboilerplate/as ... rovider.cs</a>.

    I have already done that. I just want to know where are the default values defined in the code?

  • User Avatar
    0
    alper created
    Support Team

    hi,

    have you seen this doc <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Setting-Management?searchKey=setting%20management#defining-settings">https://aspnetboilerplate.com/Pages/Doc ... g-settings</a>

    [attachment=0:16s3vigq]default-setting-values.jpg[/attachment:16s3vigq]