Just trying to get some opinions on whether or not CommandHandlers can/should communicate with other CommandHandlers.
Here is a simple case I just ran into. I have a ChangePasswordCommandHandler who's command looks like the following:
public class ChangePasswordCommand : Command
{
public string Email { get; }
public string OldPassword { get; set; }
public string NewPassword { get; set; }
}
So, inside the handler I need to validate the users olds password, so as I see it I have three options:
I'm running into a few technical issues with dispatching to other handlers mostly b/c i'm using a transaction per-web request, so i have two transactions trying to contend.
Thoughts?
Command handler handles command. If ChangePasswordCommandHandler
dispatches validation to ValidateCredentialsCommandHandler
, what command does ValidateCredentialsCommandHandler
handles then?
In short - no, i don't think that makes sense.
2nd option sounds best from ones You mentioned.