Hi,
Would you please clarify the following questions:
- I don't know where the modified settings are saved (as described in <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Setting-Management">http://www.aspnetboilerplate.com/Pages/ ... Management</a>). I could not find them in AbpSettings table.
- Also, I don't know how to give default values for settings like "App.UserManagement.UseCaptchaOnRegistration". Should I set the value in app.config?
- Can we have the values from appsettings.json all over the solution?
- Are the values passed to setting providers aggregated or each module has only access to its own settings?
Thanks, Payman
6 Answer(s)
-
0
Hi,
- Settings are stored in this table, AbpSettings. But if you don't have a setting value different than setting's default value, it is not stored here.
- You can give default values just like we do in AppSettingProvider class.
- Yes.
- Module settings are aggregated, a module can access another module's settings.
I hope this helps. Please write back if there are unclear points.
-
0
-
0
Hi,
For #1: All settings have default values, let's say you have a setting called MinPasswordLength has a default value of 6. So, at the beginning there is no value in the database because default setting value is defined and stored in code. When someone changes this setting for a tenant or for a user to 6, it is not written to database because it has the same value with the default value of setting. But if it is chagned to 5 for a tenant or user, then it is stored. After that, if someone changes it's value from 5 to 6 again, then the stored setting record is deleted from AbpSettings table. Please write back if you have a different case.
For #3: AppConfigurations class is used for that. You can use it like this:
var config = AppConfigurations.Get( typeof(AbpZeroTemplateTestModule).Assembly.GetDirectoryPathOrNull() ); var multiTenancyConfig = config["MultiTenancyEnabled"];
-
0
Hi,
Thank you so much! For #3, is it the way we can use the settings from appsettings.json in all projects or only in mvc/host project?
-
0
You can access to appsettings.json from any project, no restriction. You can use AppConfigurations.Get as shown.
-
0
Thank you :-).