Issue
This Content is from Stack Overflow. Question asked by Ahmad
I am using MediatR
and CQRS
in real project in Clean Architecture
principle.
it’s correct to:
1- Call Command
from NotificationHandler
?
2- Call Command
in Command
?
3- Call Query
in Command
?
if you have some resource for these principle please share with me.
Solution
Mediator handlers, commands, queries and notifications should follow the Single responsibility principle (SRP). They should do as little as possible, be atomical. Calling other commands, queries or notifications within a handler is a bad habit as it creates coupling.
This Question was asked in StackOverflow by Ahmad and Answered by klekmek It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.