예제 #1
0
        private static void construct(AggregateInfo aggregateInfo, Message creationMessage)
        {
            var creationConstructor = aggregateInfo.Type.GetConstructor(new[] {creationMessage.GetType()});
            if (creationConstructor == null) throw new MissingMethodException(aggregateInfo.Type.FullName, "constructor");

            creationConstructor.Invoke(aggregateInfo.Instance, new object[] {creationMessage});
        }
예제 #2
0
 protected internal void Create(AggregateInfo aggregateInfo, Event @event)
 {
     var aggregate = blank(aggregateInfo.Type);
     aggregateInfo.Instance = aggregate;
     aggregateInfo.Lifestate = AggregateLifestate.Live;
     construct(aggregateInfo, @event);
 }
예제 #3
0
        public AggregateInfo this[Type aggregateType, object key]
        {
            get
            {
                var id = new Tuple<Type, object>(aggregateType, key);

                if (!trackedAggregate.ContainsKey(id))
                    trackedAggregate[id] =
                        new AggregateInfo(aggregateType, key);

                return trackedAggregate[id];
            }
        }
예제 #4
0
        protected internal void Buildup(AggregateInfo aggregateInfo, ICollection<Event> replayEvents)
        {
            var creationEvent = replayEvents.First();
            var changeEvents = replayEvents.Skip(1);

            var aggregate = blank(aggregateInfo.Type);

            aggregateInfo.Instance = aggregate;
            aggregateInfo.Lifestate = AggregateLifestate.Building;

            construct(aggregateInfo, creationEvent);
            replay(changeEvents, aggregate);

            aggregateInfo.Lifestate = AggregateLifestate.Live;
        }
예제 #5
0
 public ConsumptionLog(RaisedEvent @event, DateTimeOffset collectedTimestamp, AggregateInfo affectedAggregate)
 {
     EventThumbprint = @event.Thumbprint;
     ConsumedTimestamp = collectedTimestamp;
     AffectedAggregate = affectedAggregate;
 }
예제 #6
0
 protected internal void Create(AggregateInfo aggregateInfo, Command command)
 {
     var aggregate = blank(aggregateInfo.Type);
     aggregateInfo.Instance = aggregate;
     construct(aggregateInfo, command);
 }