Exemplo n.º 1
0
        public static MeetupAggregate From(Guid id, IEnumerable <object> events)
        {
            var aggregate = new MeetupAggregate();

            foreach (var ev in events)
            {
                aggregate.When(ev);
            }
            return(aggregate);
        }
Exemplo n.º 2
0
        public static MeetupAggregate Build(MeetupId id, params object[] events)
        {
            var meetup = new MeetupAggregate(id);

            events.ToList().ForEach(ev =>
            {
                meetup.State.EnsureCanRaiseEvent(ev.GetType());
                meetup.When(ev);
                meetup.EnsureInvariants();
            });
            return(meetup);
        }