Exemplo n.º 1
0
        private static void OnSoldierCreateEvent(SoldierCreatedEvent createSoldier)
        {
            using (IEventStream stream = _store.OpenStream(_castleId))
            {
                var @event = new CreateSoldierEvent(Guid.NewGuid(), ProductionTime);

                stream.Add(new EventMessage {
                    Body = @event
                });
                stream.CommitChanges(Guid.NewGuid());
            }
        }
Exemplo n.º 2
0
        private static void CreateSoldier()
        {
            Console.WriteLine("Create soldier");
            using (IEventStream stream = _store.OpenStream(_castleId, 0))
            {
                var @event = new CreateSoldierEvent(Guid.NewGuid(), ProductionTime);

                stream.Add(new EventMessage {
                    Body = @event
                });
                stream.CommitChanges(Guid.NewGuid());
            }
        }