CQRS Concepts
Split commands from queries for clarity.
What Is CQRS?
CQRS stands for Command Query Responsibility Segregation. The idea is simple: separate the code that changes state (commands) from the code that reads state (queries).
// Commands : change state, return little or nothing
// Queries : return data, change nothingCommands
A command expresses an intent to change the system - create an order, cancel a subscription. It is named imperatively and typically returns only an id or nothing.
public record CreateOrderCommand(int CustomerId, string[] Items);
public record CancelOrderCommand(int OrderId);