Base solution for your next web application
Open Closed

how to extend settings in asp.net boilerplate #9998


User avatar
0
luo0826 created

Prerequisites

Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • What is your product version?
  • 9.3.0
  • What is your product type (Angular or MVC)?
  • MVC
  • What is product framework type (.net framework or .net core)?
  • .net core

If issue related with ABP Framework

  • What is ABP Framework version?

If issue is about UI

  • Which theme are you using?
  • What are the theme settings?

I'm using asp.net Zero to develop our project. I want to save our settings in AbpSettings table.But we have to add a filed named year. when I get settings or insert settings,year filed is required.now I have extended Setting class and year filed is added to database.But i have no idea about how to extend SettingManager.I have read the source code of asp.net boilerplate.It seems no way to do that. Does any body know how to do that? Thank you very much!


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

    Hi,

    You can implement your own version of SettingManager, either implementing ISettingManager or deriving your new class from SettingManager.

    Then, you can replace default implementation using the line below in your Core module's PreInitialize method;

    Configuration.ReplaceService<ISettingManager, MySettingManager>(DependencyLifeStyle.Transient);
    
  • User Avatar
    0
    luo0826 created

    Thank you for your answer,I have derived my own class from SettingManager like this: And replaced the service by this: Configuration.ReplaceService<ISettingManager, IentrySettingManager>(DependencyLifeStyle.Transient); but how can I use it in controller.As the SettingManager property is defined in the base controller class,how can I inject my own SettingManager as a property in base controller? Thank you very much.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @luo0826,

    You need to directly insert ISettingManager or you can create your own base class and use ISettingManager in that class similar to what current base controller does.

  • User Avatar
    0
    luo0826 created

    thank you , I will try