EventStore + RavenDB, not deserializing correct

家住魔仙堡 提交于 2019-12-08 04:16:32

问题


Trying out JOliver CommonDoman/EventStore 3.0 with RavenDB, where it works fine to store events, but when trying to load an aggregate root with IRepository.GetById() there is an issue in deserialization.

Giving the error message "Unable to cast object of type 'Raven.Abstractions.Linq.DynamicList' to type 'System.Collections.Generic.List`1[EventStore.EventMessage]'."

at DocumentObjectSerializer.cs,

public T Deserialize<T>(object document)
{
    Logger.Verbose(Messages.DeserializingStream, typeof(T));
    return (T)document;
}

where T is List<EventStore.EventMessage>

The code I use to get the document back is this:

var r = _repository.GetById<Recipe>(command.Id); 
//where _repository is CommonDomain.Persistence.EventStore.EventStoreRepository 

//the EventStore wire up is, 
return Wireup.Init() 
             .UsingRavenPersistence("RavenDB")
             .UsingSynchronousDispatchScheduler(bus)
             .Build(); 

来源:https://stackoverflow.com/questions/9295503/eventstore-ravendb-not-deserializing-correct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!