BT

New C# based CQRS Tutorial available

by Jan Stenberg on May 31, 2013 |

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.

 

Hello stranger!

You need to Register an InfoQ account or 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

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT