Hello,
I have a custom scheduled task in my project. So I have a class that derives from the "BaseScheduledTaskAddIn" class. Is there any way to use constructor dependency injection in those tasks? Or anywhere in DW in general? So to have something like this:
public class AwesomeScheduledTask : BaseScheduledTaskAddIn
{
private readonly IAwesomeService service;
public AwesomeScheduledTask(IAwesomeService service)
{
this.service = service;
}
public override bool Run()
{
service.DoSomethingAwesomeHere(); //service will always be null here???
return true;
}
}
And have the "service" reference resolved by the DI container?
I tried multilple different approaches and it seems like the scheduled task instances are created by reflection and they need a parameterless constructor. Does that mean that there's no way to use dependency injection in DynamicWeb?