Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public ActorSnapshot(ActorDesc actorDesc, ISnapshotArgs args)
 {
     Desc = actorDesc;
     Args = args;
 }
Exemplo n.º 3
0
 internal virtual void Initialize(ActorContext context, ActorDesc desc)
 {
     this.context  = context;
     this.desc     = desc;
     this.snapshot = desc.InitSnapshot();
 }
Exemplo n.º 4
0
 public TActor CreateActor <TActor>(ActorDesc desc)
     where TActor : Actor, new()
 {
     return((TActor)CreateActor(desc));
 }