oskardudycz/EventSourcing.NetCore

Should use Singleton for `EventStoreDBExpectedStreamRevisionProvider`

ebi-j opened this issue · 0 comments

ebi-j commented

EventStoreDBExpectedStreamRevisionProvider doesn't always return what's set in If-Match, it is because it's injected as a scoped instance, thus when it's set to a new version, it will still read the older version ( because it's another instance) when trying to append an event.

How to reproduce:

Run Simple EventStoreDB example, initialize a shopping cart, and then confirm the shopping cart (version 0), and confirm it again (turn off the validation, version 1), you'll see WrongExpectedVersionException with expected version 0, but actual 1.