Its.Cqrs icon indicating copy to clipboard operation
Its.Cqrs copied to clipboard

redesign IEventSourcedRepository.Refresh

Open jonsequitur opened this issue 9 years ago • 0 comments

This method signature makes it easy for an aggregate to be in an incorrect state after refresh, if the following sequence occurs:

  1. Apply command
  2. Event updates aggregate state
  3. Save results in a concurrency exception
  4. Refresh is called
  5. Command is re-applied

A new aggregate instance needs to be sourced for this to work correctly. The method can still be used as a query optimization (not having to re-query the events already in memory) but it should return a new aggregate instance so that the possible effects of step 2 are undone.

jonsequitur avatar Dec 11 '15 01:12 jonsequitur