Setting Management Module
Setting Management Module implements the ISettingStore
(see the setting system) to store the setting values in a database and provides the ISettingManager
to manage (change) the setting values in the database.
Setting Management module is already installed and configured for the startup templates. So, most of the times you don't need to manually add this module to your application.
ISettingManager
ISettingManager
is used to get and set the values for the settings. Examples:
So, you can get or set a setting value for different setting value providers (Default, Global, User, Tenant... etc).
Use the
ISettingProvider
instead of theISettingManager
if you only need to read the setting values, because it implements caching and supports all deployment scenarios. You can use theISettingManager
if you are creating a setting management UI.
Setting Cache
Setting values are cached using the distributed cache system. Always use the ISettingManager
to change the setting values which manages the cache for you.
Setting Management Providers
Setting Management module is extensible, just like the setting system. You can extend it by defining setting management providers. There are 5 pre-built setting management providers registered by the order below:
DefaultValueSettingManagementProvider
: Gets the value from the default value of the setting definition. It can not set the default value since default values are hard-coded on the setting definition.ConfigurationSettingManagementProvider
: Gets the value from the IConfiguration service. It can not set the configuration value because it is not possible to change the configuration values on runtime.GlobalSettingManagementProvider
: Gets or sets the global (system-wide) value for a setting.TenantSettingManagementProvider
: Gets or sets the setting value for a tenant.UserSettingManagementProvider
: Gets the setting value for a user.
ISettingManager
uses the setting management providers on get/set methods. Typically, every setting management provider defines extension methods on the ISettingManagement
service (like SetForUserAsync
defined by the user setting management provider).