Has MediatR been used incorrectly in this project. #930
-
I have been given a project with no contact possible with the previous developer. I have not used MediatR or the mediator pattern before but I have the feeling it has been done incorrectly in this project. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh that is kinda weird, I've not had the query DTO be an inner class of the handler itself. Sometimes folks make the handler and DTOs be inner classes of the same empty parent class, but a namespace will do the same trick. I do place these classes adjacent to each other on disk though, since queries and handlers are naturally cohesive (they change with each other). The bigger error here is not using |
Beta Was this translation helpful? Give feedback.
Oh that is kinda weird, I've not had the query DTO be an inner class of the handler itself. Sometimes folks make the handler and DTOs be inner classes of the same empty parent class, but a namespace will do the same trick. I do place these classes adjacent to each other on disk though, since queries and handlers are naturally cohesive (they change with each other).
The bigger error here is not using
await
. TheSend
method is async and should be awaited. CallingResult
can result in deadlocks.