Open
Description
I wonder if this is as designed and if it is can you explain a work around please? I am trying to DI my services into a base class and I want the derived implementations to also have those services injected.
Is this possible? Sorry for the wording its late and its been a busy week,
I have tried it as virtual and non virtual. I have tried calling the base init and not. Nothing seems to call the Init Method and the services are always null.
Base class:
public abstract class RenderTask : MonoBehaviour, IRenderTask
{
private ICastleLogger _logger;
protected ICastleLogger Logger => _logger;
private FileService _fileService;
protected FileService FileService => _fileService;
private PipelineService _pipelineService;
protected PipelineService PipelineService => _pipelineService;
[Inject]
public virtual void Init(ICastleLogger logger, FileService fileService, PipelineService pipelineService)
{
_logger = logger;
_fileService = fileService;
_pipelineService = pipelineService;
}
}
Derived class
public class Split360 : RenderTask
{
[Inject]
public override void Init(ICastleLogger logger, FileService fileService, PipelineService pipelineService)
{
base.Init(logger, fileService, pipelineService);
}
}
Metadata
Metadata
Assignees
Labels
No labels