/// <summary> /// Retrieves an aggregate from offline storage and returns only its most recent state. /// </summary> public T Unbox <T>(Guid aggregateId) where T : AggregateRoot { var snapshot = _snapshotStore.Unbox(aggregateId); var aggregate = AggregateFactory <T> .CreateAggregate(); aggregate.AggregateIdentifier = aggregateId; aggregate.AggregateVersion = 1; aggregate.State = _eventStore.Serializer.Deserialize <AggregateState>(snapshot.AggregateState, aggregate.CreateState().GetType()); return(aggregate); }
/// <summary> /// Retrieves an aggregate from offline storage and returns only its most recent state. /// </summary> public T Unbox <T>(Guid aggregateId) where T : AggregateRoot { var snapshot = _snapshotStore.Unbox(aggregateId, typeof(T)); var aggregate = AggregateFactory <T> .CreateAggregate(); aggregate.AggregateIdentifier = aggregateId; aggregate.AggregateVersion = 1; aggregate.State = snapshot.AggregateState; return(aggregate); }