http://udidahan.weblogs.us/archives/036867.html
Udi Dahan demonstrates how to leverage Generics for Command Handling, NICE.
Excerpt:
public class CommandHandler<T> where T : IEntity
{
public CommandHandler()
{
NewCommand.Activated += delegate(object sender, EntityEventArgs e)
{
if (e.EntityType == typeof(T))
{
IView v = this.builder.Build<IEntityView<T>>();
v.Show();
}
};
}
}
and then you'd just instantiate a command handler for each entity type like so:
new CommandHandler<Customer>();
new CommandHandler<Order>();