Skip to content

Instantly share code, notes, and snippets.

Created Apr 23, 2015
What would you like to do?
// both actors require dependencies that can be fulfilled by DI
// but you can't do this:
var system = ActorSystem.Create("App");
var actor = system.ActorOf<SomeActor>();
class ActorA : ReceiveActor {
public SomeActor(IDependency dependency) { ... }
var child = context.ActorOf<ActorB>();
class ActorB : ReceiveActor {
public SomeActor(IDependency dependency) { ... }
// instead you must code in two different ways:
var propsResolver = new SomeDIPropsResolver();
var props = propsResolver.Resolve<ActorA>();
var actor = system.ActorOf(props);
// and inside of the actor you must do
var child = context.DI().ActorOf<ActorB>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment