I've been building an asp.net core website, using the asp.net boilerplate template. As of now, I've been storing all of the settings in the appsettings.json file. As the application gets bigger, I'm thinking I should start storing some settings via ABP's SettingProvider and ISettingStore.
My question is, does anyone have, or know of, a sample application that show's how to implement ISettingStore and storing the settings in the database?
The only post I could find so far is this, but the link hikalkan supplies is broken.
Thanks for any help, Joe
ABP stores settings on memory with default values. When you insert a new setting value into database, then it reads from database and overrides the default value. So basically when database has no settings then it means all the settings are on default values. Setting values are stored in AbpSettings table. To start using settings mechanism. Create your own SettingProvider inherited from SettingProvider. Initialize it in your module (eg: ModuleZeroSampleProjectApplicationModule). As SettingProvider is automatically registed to dependency injection; You can inject ISettingManager wherever you want.
In application services and controllers you don't need to inject ISettingManager (because there's already property injected) and you can directly use SettingManager property. Forexample :
And for the other classes (like Domain Services) can inject ISettingManager
Note: To modify a setting you can use these methods in SettingManager ChangeSettingForApplicationAsync, ChangeSettingForTenantAsync and ChangeSettingForUserAsync