Skip to content

Has MediatR been used incorrectly in this project. #930

Answered by jbogard
mike-azility asked this question in Q&A
Discussion options

You must be logged in to vote

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. The Send method is async and should be awaited. Calling Result can result in deadlocks.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mike-azility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants