dotnet-architecture / eBooks

.NET Architecture e-Books
http://dot.net/architecture
1.13k stars 259 forks source link

Clarification about Command Pattern #64

Closed JoaoCampos07 closed 2 years ago

JoaoCampos07 commented 3 years ago

Hello

Maybe, this part can be improve a little bit . For me, it confunse me little bit. In page 277 there is : "A command handler receives a command and obtains a result from the aggregate that is used. The result should be either successful execution of the command, or an exception." But later when talking about MediaR : "Here the behavior is raising an exception if validation fails, but you could also return a result object, containing the command result if it succeeded or the validation messages in case it didn’t. This would probably make it easier to display validation results to the user" After re-reading I understood, that this is for the validation of the command, and the Handle of the command was not call at this point. Is still being validated. But in my opinion it would be better to refer that. That we are in the validation phase. That's return object is not wrong.