Wednesday, 21 August 2013

J Oliver EventStoreRepository is not returning snapshots

J Oliver EventStoreRepository is not returning snapshots

I am using the EventStore framework made by J Oliver. I have notices that
when I create a snapshot, it is not being passed to my aggregate factory
and I am wondering why. This is my aggregate factory method constructing
aggregates:
public IAggregate Build(Type type, Guid id, IMemento snapshot)
{
ConstructorInfo constructor =
type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance,
null, new[] { typeof(Guid) }, null);
IAggregate aggregate = constructor.Invoke(new object[] { id }) as
IAggregate;
}
The snapshot parameter is null when it should be filled with a snapshot
since when I add this to the method:
Snapshot snapshotContainer = _store.Advanced.GetSnapshot(id, int.MaxValue);
snapshot = snapshotContainer == null ? null : snapshotContainer.Payload as
IMemento;
it shows me that snapshot is filled. What is going on here?

No comments:

Post a Comment