There are two basic ideas in CQRS:

  1. Objects should not have direct access to view or modify other object’s state.
  2. There should be separate codes to get (query) or modify (command) the state of an object. In simple word, Command method is Void, where, Query method has a return type.

So, how does an object can interact with other parts of the code if they do not have access to its fields? The answer is: “through Events”.

Classes should listen to specific types of events which are propagating in the system and act upon or reply to them.

© 2019. All rights reserved.