Open Closed

Manage Setting from Database #243


0
saraya created

Hi Halil, How can I manage setting's value from data Base ?? I have also changed this line

SettingStore = settingStore;//NullSettingStore.Instance; //Should be constructor injection? For that, ISettingStore must be registered!

in SettingManager Constructor , but from the begging of the application it reads the setting value from GetSettingDefinitions of SettingProvider !!!!


3 Answer(s)
  • 0
    hikalkan created
    Support Team

    Hi,

    I haven't undestood well. Can't you just inject and use ISettingManager to change settings? Please, can you explain in more detail. Thanks.

  • 0
    saraya created

    Hi again , ISettingManager doesn't get setting value from Setting table in database it gets value from 'SettingProvider ' , may be i should define 'SettingDefinitionProviderContext' but I don't no How !!??!!

  • 0
    hikalkan created
    Support Team

    Hi,

    No, ISettingManager jus gets definitions of settings from SettingProvider, not values! Values are gotten from ISettingStore. And if you use module-zero, then it implements ISettingStore to get setting values from database table named AbpSettings. So, just inject and use ISettingManager to get/change settings in the database.

    For example, check <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/blob/master/sample/ModuleZeroSampleProject.Application/Questions/QuestionAppService.cs#L44">https://github.com/aspnetboilerplate/mo ... ice.cs#L44</a> it gets a setting from database using setting manager.