How would one apply command query separation (CQS), when result data is needed from a command?

后端 未结 10 2158
慢半拍i
慢半拍i 2021-01-30 06:25

In wikipedia\'s definition of command query separation, it is stated that

More formally, methods should return a value only if they are referentially t

10条回答
  •  野性不改
    2021-01-30 07:02

    CQS is mainly used when implementing Domain Driven Design, and therefore you should (as Oded also states) use an Event Driven Architecture to process the results. Your string result = order.Result; would therefore always be in an event handler, and not directly afterwards in code.

    Check out this great article which shows a combination of CQS, DDD and EDA.

提交回复
热议问题