EventStore + RavenDB,没有反序列化正确
尝试使用RavenDB的JOliver CommonDoman / EventStore 3.0,它可以很好地存储事件,但是当尝试使用IRepository.GetById()加载聚合根时,反序列化会出现问题。
给出错误消息“无法将类型为’Raven.Abstractions.Linq.DynamicList’的对象’转换为’System.Collections.Generic.List`1 [EventStore.EventMessage]’。”
在DocumentObjectSerializer.cs,
public T Deserialize(object document) { Logger.Verbose(Messages.DeserializingStream, typeof(T)); return (T)document; }
其中T是List
我用来获取文档的代码是这样的:
var r = _repository.GetById(command.Id); //where _repository is CommonDomain.Persistence.EventStore.EventStoreRepository //the EventStore wire up is, return Wireup.Init() .UsingRavenPersistence("RavenDB") .UsingSynchronousDispatchScheduler(bus) .Build();