コード例 #1
0
        public void Consume(ThingCreated @event)
        {
            var things = this.thingsRepository.Get(Root);

            if (things == null)
            {
                things = new Data.Things {
                    Names = new List <string>()
                };
            }

            things.Names.Add(@event.Name);

            this.thingsRepository.AddOrUpdate(Root, things);
            this.thingRepository.AddOrUpdate(@event.Id, new Data.Thing {
                Name = @event.Name
            });
        }
コード例 #2
0
        // these need to be created with a name of "Apply", and a single parameter that is an event.
        // Do not call these directly. They are called via reflection from ApplyEvent

        private void Apply(ThingCreated @event)
        {
            this.Id = @event.Id;
            this.Name = @event.Name;
            this.Description = @event.Description;
        }
コード例 #3
0
 public void Consume(ThingCreated @event)
 {
     this.repository.AddOrUpdate(@event.Id, new Data.Thing {
         Name = @event.Name
     });
 }