【发布时间】:2020-10-27 19:07:54
【问题描述】:
我正在使用 J Oliver 制作的 EventStore 和 CommonDomain 框架。我注意到当我创建快照时,它没有被传递到我的聚合工厂,我想知道为什么。这是我构建聚合的聚合工厂方法:
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;
}
当我将它添加到方法中时,当它应该填充快照时,快照参数为空:
Snapshot snapshotContainer = _store.Advanced.GetSnapshot(id, int.MaxValue);
snapshot = snapshotContainer == null ? null : snapshotContainer.Payload as IMemento;
它显示快照已满。这是怎么回事?
【问题讨论】:
标签: c# snapshot event-sourcing neventstore