I’ve started to play around with EventStore and was leveraging the CommonDomain stuff as a start. I am using NancyFx as a thin “web api” layer.
I have an an Employee aggregate storing an id, personal info (name, gender, etc.), contact information (email addresses, etc.) and family information. When a post is made to domain/Employees, I build a CreateEmployee command which is turned in to 4 events… EmployeeCreated (establishes the unique id); PersonalDetailsReplaced (replaces name, birth date, gender, etc.); ContactInfoReplaced (replaces email addresses, etc.); FamilyInfoReplaced (yep, replaces family data).
When I try to Save all four [uncommitted] events, I get some weird results. Since only four events, I am using the AppendToStreamAsync method.
Creating the metadata with a commitId (Guid), aggregateClrTypeName and eventClrTypeName doesn’t seem to work. Seems like the server overwrites and creates its own commitId and type name information. Is this expected? Any pointers on how/where I would change the behavior? When creating the EventData to send to AppendToStreamAsync, should the serialized metadata byte field only contain information above and beyond these three fields?
When saving the first aggregate, the commitId is always zeros (a guid consisting of all zeros) which shouldn’t be the case
When saving the second aggregate (different data), the serializer seems to change and now includes TypeHandlingInfo?! So, the metadata has a $type of IDictionary<string,object>… why did the serializer settings change as the program is running?
When saving the third and fourth aggregates (replaying the previous two post commands), the save appears to work as expected – a proper commitId (but not set by me) and the type information for the aggregate and event (also not set by me)… in fact when I create EventData now, I pass null for the metadata byte array (cause I wanted to make sure I wasn’t setting the metadata).
Why does it take until the 3rd write attempt to get it right? Have I configured something in correctly?
I am using EventStore server 3.0.1 and ClientAPI 3.0.1.
Thanks for your time and help.