Exemplo n.º 1
0
        public SpaceObjectActor(WorldContextFactory worldContextFactory, SpaceObject so) : base(so)
        {
            _worldContextFactory = worldContextFactory;

            using (var worldContext = _worldContextFactory.CreateDbContext())
            {
                var peristedSpaceObject = GetPersistedSpaceObject(worldContext, so);

                foreach (var component in peristedSpaceObject.Components)
                {
                    var props = ResolveComponent(component);
                    Context.ActorOf(props, $"component_{component.Id}");
                }

                _log.Info($"{peristedSpaceObject.Components.Count} child components loaded.");
            }
        }
Exemplo n.º 2
0
 public WorldContextActor(WorldContextFactory worldContextFactory)
 {
     _worldContextFactory = worldContextFactory;
 }
Exemplo n.º 3
0
 public static Props Props(WorldContextFactory worldContextFactory, SpaceObject so)
 {
     return(Akka.Actor.Props.Create(() => new SpaceObjectActor(worldContextFactory, so)));
 }