CQRS in .NET Without the Cargo Cult: A Practical Guide for 2026Mixed sources2 sources, drawn from a mix of official docs, project repositories and research.This rates where the sources come from. It doesn't prove every claim.
CQRS as a folder discipline, command/query handlers without MediatR, vertical slice architecture, and when eventual consistency is overkill.
By Amit UpadhyayPublished Updated 15 minArticle 3 of 10 in Backend (.NET / C#)
AI assistant · answers from this article
1 of 6
Five entities, four screens
Nothing to add yet
For a small domain, one service class that reads and writes is the simplest thing that works.
On this page
CQRS, in one sentence
CQRS separates the code that changes data from the code that reads it, because the two have different needs and get in each other’s way.
You reach for it when one service class handles both changes (place, cancel) and many different screens of reads. Not before: it costs more, smaller classes, and discipline about not reusing domain entities for reads.
The cheat sheet
What to use when
You do not need all of this on day one. Each row is one signal and the piece that answers it. Stop at the row your system has reached, or pick one to see it in the picture above.
Where you areThe signalWhat to useWhat it costs
None. The service is small, and one class is easy to follow.Nothing. A service classNothing
Every pull request touches the same 1,400-line service, and rebases conflict.One handler for each command and each queryHandlers without MediatR ↓More files, and a folder discipline
A read loads whole entities to show three fields, and the domain model is bent around the screens.Queries that project straight to a DTOA query ↓A DTO for each screen
A command handler has reached two hundred lines of business rules.Rules in the aggregate. Handlers orchestratePitfalls ↓Domain modelling work
A retried request places the same order twice.An idempotency key at the command boundary, backed by a unique indexA command ↓A key from every caller, and an index
A read is slow, and someone proposes a separate read store.An index, a covering projection or a cache firstA spectrum ↓If you do split later: eventual consistency the product has to design for
Start With a Service Class
If your domain has five entities and four screens, a service class is fine. Splitting commands from queries pays back when one class has become the file every change touches, and reads and writes are pulling the same model in different directions.
A typical .NET service starts with one OrderService that has fifteen methods — PlaceOrder, GetOrder, ListOrders, SearchOrders, UpdateShippingAddress, CancelOrder, and so on. Reads and writes share the same domain model. Six months in, the read methods carry six different DTO shapes for six different screens; the write methods carry domain invariants no read needs. Touching one breaks the other. Pull requests block on rebase conflicts in a single 1,400-line file.
🤔 If one service class does everything
Reads and writes have asymmetric requirements. Writes care about invariants, transactions, and concurrency. Reads care about projection shape, latency, and screen-specific data. CQRS — Command/Query Responsibility Segregation — is the simple act of stopping the pretence that they are the same thing.
CQRS is not Event Sourcing. It is not a separate database. It is not even necessarily MediatR. At its smallest, CQRS is “a method either changes state or returns data, never both” (Meyer's Command-Query Separation, lifted up to the responsibility/architectural layer by Greg Young). Everything else — separate read models, separate stores, async projection — is an option you adopt when the workload demands it.
Pro deep dive15 min full read
Keep reading with Pro
This is one of our advanced production deep dives. Pro unlocks the rest of it, every other deep dive, and the See, Animate, Test and Build modes on every topic.
What it covers
CQRS as a folder discipline, command/query handlers without MediatR, vertical slice architecture, and when eventual consistency is overkill.