Skip to content
bitzorcas
EN

Concept

CQRS Command/Query Segregation

Parallel command and query processing flows with shared and dedicated pipeline behaviors.

Last updated

Overview

The CQRS segregation diagram shows two parallel flows: the command path (left) with full pipeline behaviors including transaction, authorization, idempotency, and audit; and the query path (right) with only logging and validation. Both share the Mediator as the entry point.

Key takeaways

  • Commands run 7 pipeline behaviors — every guard and cross-cutting concern applies
  • Queries run only 2 behaviors — logging and validation, for maximum performance
  • Dapper is preferred for query handlers — direct SQL without change tracking overhead
  • Command handlers mutate state through IUnitOfWork; query handlers are pure reads