Is there any way to inject dependencies in to the Azure Service Fabric Actor\'s constructor?
I know this is old but for documentations' sake DI is now supported in the Reliable Actor framework just like you would expect.
public class ActorOne : Actor, IMyActor{
private readonly IDependency _dependency;
public ActorOne(IDependency dependency)
{
_dependency = dependency;
}}
And then you register the Actor with its dependency with the Service Fabric like this:
using (FabricRuntime fRuntime = FabricRuntime.Create()){
fRuntime.RegisterActor(() => new ActorOne(new MyDependency());
Thread.Sleep(Timeout.Infinite);}