In a screen that displays many order detail lines of order, users can add, update, or delete rows or columns and then click the "Save" button to save all the order changes in one transaction.
Option 1: Create one Command (which will be created by the Clicking
event of the button), saying UpdateOrderCommand
, which has complex internal data structures for all the changes. And the command will apply the changes to the database table. (So the UI part code will need to track all the changes for the command.)
Option 2: Create AddOrderLineCommand
, DeleteOrderLineCommand
, UpdateOrderLineCommand
, and SaveOrderCommand
. And every operation on the UI will create a request and the "Save" button will invoke SaveOrderCommand
. However, it will need some stateful service to keep all the unsaved changes.
Which one is CQRS idiomatic approach?