Awesome
CommandQuery<!-- omit in toc -->
Content<!-- omit in toc -->
Introduction
Command Query Separation (CQS) for .NET and C#
- Build services that separate the responsibility of commands and queries
- Focus on implementing the handlers for commands and queries
- Create APIs with less boilerplate code
Available for:
š ASP.NET Core
ā” AWS Lambda
ā” Azure Functions
ā” Google Cloud Functions
Command Query Separation?
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.
ā <cite>Martin Fowler</cite>
In other words:
- Commands
- Writes (create, update, delete) data
- Queries
- Reads and returns data
The traditional approach that commands do not return a value is a bit inconvenient.
CommandQuery
has a pragmatic take and supports both commands with and without result š
Packages
CommandQuery
āļø
Command Query Separation for .NET
- š README: CommandQuery.md
- š Samples:
CommandQuery.AspNetCore
š
Command Query Separation for ASP.NET Core
- š README: CommandQuery.AspNetCore.md
- š Samples:
CommandQuery.AWSLambda
ā”
Command Query Separation for AWS Lambda
- š README: CommandQuery.AWSLambda.md
- š Samples:
CommandQuery.AzureFunctions
ā”
Command Query Separation for Azure Functions
- š README: CommandQuery.AzureFunctions.md
- š Samples:
CommandQuery.GoogleCloudFunctions
ā”
Command Query Separation for Google Cloud Functions
- š README: CommandQuery.GoogleCloudFunctions.md
- š Samples:
CommandQuery.Client
š§°
Clients for CommandQuery APIs
- š README: CommandQuery.Client.md
- š Samples:
Upgrading
ā¬ļø Upgrading from version
3.0.0
to4.0.0
Upgrade AspNetCore:
- Upgrade the project target framework to
net8.0
Upgrade AWSLambda:
- Upgrade the project target framework to
net8.0
Upgrade AzureFunctions:
- Upgrade the project target framework to
net8.0
- Remove the
logger
argument fromHandleAsync
- Consider to use the
HttpRequest
versions ofHandleAsync
Upgrade GoogleCloudFunctions:
- Upgrade the project target framework to
net8.0
- Remove the
logger
argument fromHandleAsync
Acknowledgements
Inspired by Steven van Deursen blog posts: