Reputation: 11811
EventMessage.Body isn't deserialized back into the original object when using ServiceStack. Instead EventMessage.Body is a JSON string.
To reproduce:
-
var stream = store.OpenStream(StreamId, 0, int.MaxValue);
var myFirstEvent = (SomeDomainEvent) (stream.CommittedEvents.First().Body);
Console.Out.WriteLine("MyFirstEvent.Value=" + myFirstEvent.Value);
Upvotes: 2
Views: 353
Reputation: 143409
If it's a string and you're expecting SomeDomainEvent you could use ServiceStack's FromJson Extension method, i.e:
var myFirstEvent = stream.CommittedEvents.First().Body.FromJson<SomeDomainEvent>();
Console.Out.WriteLine("MyFirstEvent.Value=" + myFirstEvent.Value);
Upvotes: 1