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


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


This handler needs to be registered to be take into account. This can be doing with the RegisterCommandHandler of a Domain Commands Manager.
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