public Actor CreateActor(ActorDesc desc) { ActorFactoryMethod factory; if (!actorFactories.TryGetValue(desc.GetType(), out factory)) { throw new InvalidOperationException(); // TODO: Message } var actor = factory(desc); var context = new ActorContext(this, actor); actor.Initialize(context, desc); actors.Add(desc.Id, context); return(actor); }
public ActorSnapshot(ActorDesc actorDesc, ISnapshotArgs args) { Desc = actorDesc; Args = args; }
internal virtual void Initialize(ActorContext context, ActorDesc desc) { this.context = context; this.desc = desc; this.snapshot = desc.InitSnapshot(); }
public TActor CreateActor <TActor>(ActorDesc desc) where TActor : Actor, new() { return((TActor)CreateActor(desc)); }