In CQRS, how do I tell the list of valid methods for an aggregate in the user interface?

I have a summary root of Order, and it has a number of methods on it that internally set its Status field:

  • Submit
  • Place on hold
  • Hold Off
  • Make sure
  • Cancel
  • and etc.

The available actions depend on the current state of the order (for example, it cannot be put on hold if it is already on hold). The problem is that I need to provide a request to tell the user interface which commands are available, so I can hide operations that would otherwise throw InvalidOperationException.

How to do this with minimal DRY violation?

+5
source share
1

- / .

: PlaceOnHoldCommand OrderPlacedOnHoldEvent, ( EventStore) OrderTransitionsEventHandler, DB, Order. ( sth.)

, , . , , . CQRS , , DRY.

+4

All Articles