I am comparing the possibilities for using services (in the sense of a process local component like in the Windsor IoC container) from the domain model.
I have 3 ways to achieve this:
Publishing a domain event and having service layer code handling it
Injecting the service through a method on the model object
Injecting the service in the model object
(4. Using a Service Locator)
The first leads to a very expressive and repetive pattern, creating domain events and handlers in a procedural style for otherwise simple tasks. But it has the best decoupling of the model from the environment it is used within (model is self defined).
The second makes methods arguments longer and looks like it breaks encapsulation (if the action of the model object requires other services, all callers have to change).
The third will inject Dependencies that are not required for the current Transaction. Also one needs to "extend" NHibernate for this. I would avoid this method due to other recommendations read.
As i want to write this in our documentation, i need to tell the reader when to use which method. I´m thinking something along the line "Use method injection if you would put the domain event handler into the model assembly", but it does not really hit the point.
Suggestions for this rule?