Command Query Responsibility Separation

You can find about “Command Query Responsibility” many article here and here by 

  • Queries: Return a result and do not change the observable state of the system (are free of side effects).
  • Commands: Change the state of a system but do not return a value.

Single Model:

single-model

COS model :

cqrs

I studied on command processor class library in fnhmvc project in codeplex and it’s really good structure.We could examine more detailed with this post.The Command Processor consist of handler classes(command handler,validation handler),result classes(command result,validation result), diverse interfaces(ICommand,ICommandResult,ICommandResults) and DefaultCommandBus Class.Main processor class is the DefaultCommandBus class.We execute repository operations in this class.

Class Diagram:
ClassDiagram1
DefaultCommandBus’s sequence diagram 
Capture
Let’s take a look at the using command processor library

you can download all codes my project via github , have a good coding

Leave a Reply

Your email address will not be published. Required fields are marked *