Ejemplo n.º 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});
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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];
            }
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 5
0
 public ConsumptionLog(RaisedEvent @event, DateTimeOffset collectedTimestamp, AggregateInfo affectedAggregate)
 {
     EventThumbprint = @event.Thumbprint;
     ConsumedTimestamp = collectedTimestamp;
     AffectedAggregate = affectedAggregate;
 }
Ejemplo n.º 6
0
 protected internal void Create(AggregateInfo aggregateInfo, Command command)
 {
     var aggregate = blank(aggregateInfo.Type);
     aggregateInfo.Instance = aggregate;
     construct(aggregateInfo, command);
 }