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