So, a couple things:
- The inline docs say that ExpectedVersion.EmptyStream should equal 0 but it’s actually -1 which is the same as ExpectedVersion.NoStream
Not sure if that’s on purpose or if it’s a bug.
AppendToStreamAsync can take one or more EventDatas but asks for a single expected version. My case right now attempts to save a few events for a new entity so it’s a new stream of Survey-. What I did was set the expected version like this:
var expectedVersion = first.Version == 0
? ExpectedVersion.NoStream
: first.Version;
``
My reasoning is that if it’s event 0, then it’s a new stream, thus should not exist. I’m also assuming that it’s checking this version against the first EventData in the stream I’m saving. I’m getting WrongExpectedVersionException, but when I look at the event store browser, the stream was created and has a single event.
I feel like I need some clarification on how this is supposed to work.