How to create a command handler

A command handler implements the command logic. You declare it in implementing the ICommandHandler<TCommand> interface.

There is two ways to declare a command handler :
  • Directly within the command

2014-04-21_16h41_01.png

In this case, the command logic can not be contextualized by domain. It's the always the same.
  • As an independent class implementation

2014-04-21_16h49_30.png

This handler needs to be registered to be take into account. This can be doing with the RegisterCommandHandler of a Domain Commands Manager.
2014-04-21_16h55_27.png
this can be done for every time a domain is loaded in a store

Note : You can also use composition to register a command handler. See How to use composition

Last edited Apr 30, 2014 at 12:05 PM by Zenasoft, version 6