Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

SettingManager Null #710


User avatar
0
tjackadams created

Hello,

i am trying to use the SettingManager in one of my ApplicationService classes. From what i am reading in the documentation, because my class is derived from "ApplicationService" class, there is no need to inject the SettingManager and i just access it like a property. However, whenever i try and access the SettingManager its set to null and therefore it throws and exception whenever i try and access anything.

public class AutoTaskAppService : PortalAppServiceBase , IAutoTaskAppService
    {

        public AutoTaskAppService()
        {

        }

        public ATWSSoapClient AutoTaskConnection()
        {

        // Access the SettingManager
       string test = SettingManager.GetSettingValue(PortalSettingNames.AutoTaskApiUserName);

}
}

Is there a step that i'm missing? Cheers


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Are you creating your application service using dependency injection or manually with the new operator? You should resolve it using DI.

  • User Avatar
    0
    tjackadams created

    Apologies, i just misread the documentation! Its working now, just injected it into the class. Many Thanks