CQRS without the plumbing - Example app

!!! Click here to go to the quick start !!!

This example app shows how you can implement a CQRS app without to much effort using the Scritchy libraries.

More info and full source over at github or at our google group.

You find the example code in the following locations:

No infrastructure setup is required; Scritchy finds out by itself what the commands/events/ar's and eventhandlers are.

Eventstorage is also auto-wired; Scrichy looks for a connectionstring named "eventstore" in the app configuration, and if it can not find it, it uses the InMemoryEventStore.
Currently works with SQLite and MsSql(CE), but other implementations should be trivial.



This is the example of a stocklist

Currently there are no items allowed in your stocklist

Quick start

Develop a working CQRS app on your own in a few minutes

Here is a video of me implementing a domain from scratch:

  1. Start a new Project.
  2. Add Scritchy to the references using Nuget.
  3. Implement your domain using the following conventions:
    • All aggregate roots must inherit from Scritchy.Domain.AR.
    • Commands and events are routed to an AR which contains a method void [Command.GetType().Name] and where the Command contains a property named [AR.GetType().Name+"Id"].
    • Events are routed to classes that contain a method void ["On"+Event.GetType().Name].
    • Commands and event members are passed into the caller method by matching their property name.
    • Remark: all event handlers must be stateless; sagas can be implemented as event handlers.
  4. Configure the eventstore of your choice:
    • In memory persistence: do nothing.
    • Database persistence: add a connectionstring named "eventstore" to your web/app.config, and make sure the database is available and the required DLL's are referenced as well (i.e. System.Data.SQLite or System.Data.SqlServerCe for example).
    • Remark: installing Scritchy using NuGet automatically adds an example SQLite and MsSqlCe database to your App_data folder. you can use these files as your database.
  5. Create your command bus:
    1. var bus = new ScritchyBus();
      This will create a new commandbus and will auto-wire all AR's, EventHandlers, Commands.
    2. Remark: Event handlers are instantiated trough DI, which can be set in the ScritchyBus constructor.
  6. You can now send commands to the bus:
    • bus.RunCommand(new somecommand);

Recent commands


Allow Item

Ban Item

Add Items

Remove Items