tyronegroves/SimpleCQRS — Issue #18: Look ma, no commandhandlers!
Author: geoffreysmith
Created: 2012-01-01 02:31:02+00:00
State: open

90% of commandhandlers only do the following:

1. Determine whether they are creating the aggregate root or not
2. Find the aggregate root (or create it)
3. Invoke a method on the aggregate root.

I think these can all be accomplished via attributes on the command. The following is a command handler, with an aggregate root of "User" and invokes a method of "ChangeAddress":

[CommandHandler(AggregateRootAction.Update, typeof(User))]
public class UpdateUserAddressCommand : ICommand

You'd have to assume the method off the aggregate root is the same as the class name, sans the Command at the end. This is actually pretty easy. I'm not going to actually implement it because it is NYE.