问题
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