New C# based CQRS Tutorial available

| by Jan Stenberg Follow 28 Followers on May 31, 2013. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

A new CQRS, Command Query Responsibility Separation, Starter Kit to help developers get up and running with CQRS on .NET has been developed and made available as open source by Jonathan Worthington and Carl Mäsak.
The two developers notes that this is not a framework, it’s a “bunch of C# code” meant as a tutorial for developers interested in learning about CQRS, and as a possible starting ground for a CQRS based system, in which case you will change the code to fit your needs.

The tutorial code is an application in the cafe domain focusing on the concept of a tab which tracks the visit of an individual or group to the cafe. The tutorial itself is divided into five steps starting with design, domain logic and read models followed by integration into an ASP.NET MVC web application.
In the tutorial, Jonathan and Carl also bring up a few points to consider, e.g. regarding transactions and eventual consistency, if you want to extend the example to a production system.

Jonathan and Carl emphasizes that unless you are in a learning phase, you shouldn’t start with CQRS because it’s the new modern thing, instead you should arrive at this decision because of your architecture goal:

I want to work in terms of commands/events for my domain logic, because modelling and writing tests this way will help me deliver a system that meets the customer's needs. I want to persist using an event store, but that doesn't meet my querying needs. Therefore, I need to also have a relational database. This means my reads and writes need to happen through different code paths, which means I will be doing CQRS.

CQRS is an architectural pattern receiving an increasing interest. The DDD community website, maintained by among others Eric Evans, specifically notes the importance:

CQRS & Event Sourcing are two closely related architectural approaches to DDD and they are the hottest topics in DDD of the last couple of years.


Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you