Feb 02 2010

Idea: a lightweight CQRS utility library

Yesterday I started implementing some utilities to speed up development inside a CQRS architecture. In this first attempt I’m trying to reduce the friction that exists between the “typical style” of client side development and sending commands back to the server. The core idea is that there’s no need for code inside to UI layer that creates the commands; they should be inferred from state changes that happen through databinding. This allows for increased development time on task based as well as more regular UI’s. This code snippet gives you an idea of the concept.

public class PersonDto : ClientSideRepositoryItem
{
public Guid Id { get; private set; }

[OnValueChanged(typeof(ChangePersonsMaritalStatusCommand))]
public int MaritalStatus { get; set; }
}

public class ChangePersonsMaritalStatusCommand: ICommand
{
public Guid Id { get; private set; }
public int MaritalStatus { get; set; }
}

The ClientSideRepositoryItems build themselves a list of commands that can be flushed to the server in order to apply them. Autocreating the commands and setting its properties will involve some conventions. And I will need to add support for collections, value based command selection perhaps and some neat algorithms to keep the command list sane.

This is just an idea at this stage; I’m not sure it will work. Send me feedback!

7 responses so far