BoomSonK
Reuse handlers with MediatR?
Hi,
I would like to know the best approach to share the same code in a codebase with CQRS and MediatR. Suggest a simple CRUD. You have a GetById, but also an Update and Delete. For the Update and Delete handlers I also have to retrieve the entity first, but they use the same logic as the GetById handler. Now I was wondering what the best approach is to do this with principles in mind, such as DRY, SRP and the fact that you don't want to have too many dependencies to keep it modular. In short, is it common to call the Update and Delete handler into the GetById handler, or re-implement the GetById logic in the Update and Delete handler, or should I create an additional service where all those handlers get this logic from. The last option seems best to me, I think.
I'd love to hear from you!
28 replies
.NET Roadmap
I feel like I don't know where to go with my C# .NET path. I know pretty much the basics, where I could build some decent web applications. But as I said earlier I don't know what is smart to invest my time in. Do you guys have any kind of advice on which topics I could invest my time to learn? Kind of a roadmap? You can call the most simple basic stuff if it's important, because maybe I looked over it. It should be related to web applications.
Thanks 🙂
12 replies