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)
-
0
Are you creating your application service using dependency injection or manually with the new operator? You should resolve it using DI.
-
0
Apologies, i just misread the documentation! Its working now, just injected it into the class. Many Thanks