Is there any way to inject dependencies in to the Azure Service Fabric Actor\'s constructor?
Why not just use some root element field in actor, and resolve it from container with injected dependencies in Actor's constructor? If this is a bad decision, please explain why:
public class StatelessActor2 : Actor, IStatelessActor2
{
private ConfiguredContainer _container;
private IRootElement _rootElement;
public StatelessActor2()
{
_container = new ConfiguredContainer(); //... container is configured in it's constructor
_rootElement = _container.Resolve();
}
public async Task DoWorkAsync()
{
// Working with a RootElement with all dependencies are injected..
return await Task.FromResult(_rootElement.WorkingWithInjectedStuff());
}
}