-
-
Save nvivo/8192f527326af508e6ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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