Skip to content

Command Query Separation for 🌐ASP.NET Core ⚡AWS Lambda ⚡Azure Functions ⚡Google Cloud Functions

License

Notifications You must be signed in to change notification settings

hlaueriksson/CommandQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommandQuery

build CodeFactor

CommandQuery CommandQuery.Abstractions

CommandQuery.AspNetCore CommandQuery.AWSLambda CommandQuery.AzureFunctions CommandQuery.GoogleCloudFunctions

CommandQuery.Client

Content

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.

Martin Fowler

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 ⚙️

NuGet NuGet

Command Query Separation for .NET

CommandQuery.AspNetCore 🌐

NuGet NuGet

Command Query Separation for ASP.NET Core

CommandQuery.AWSLambda

NuGet NuGet

Command Query Separation for AWS Lambda

CommandQuery.AzureFunctions

NuGet NuGet

Command Query Separation for Azure Functions

CommandQuery.GoogleCloudFunctions

NuGet NuGet

Command Query Separation for Google Cloud Functions

CommandQuery.Client 🧰

NuGet NuGet

Clients for CommandQuery APIs

Upgrading

⬆️ Upgrading from version 3.0.0 to 4.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 from HandleAsync
  • Consider to use the HttpRequest versions of HandleAsync

Upgrade GoogleCloudFunctions:

  • Upgrade the project target framework to net8.0
  • Remove the logger argument from HandleAsync

Acknowledgements

Inspired by Steven van Deursen blog posts: