13/11/2025
🚀 A .NET Library That Will Clean Up Your Code!
Hey everyone! 👋
As developers, especially here in Egypt working on big projects, our code can get messy. We often have business logic tangled up everywhere. It makes features hard to change and bugs hard to find.
I want to share a library I love that really helps with this: MediatR.
Think of it as a "mailman" for your code.
Instead of one part of your application (like a controller) knowing exactly how to do everything (like talking to the database, sending an email, and updating a profile), it just sends a "request" (like a letter).
MediatR, the mailman, picks up that request and delivers it to the one class (the "handler") that knows how to deal with it.
Why is this so amazing?
* Super Clean Code: Your controllers become thin and simple. They just send requests.
* Easy to Maintain: Need to change how user profiles are updated? You only go to one place—the specific handler for it.
* Follows Design Patterns: It helps you use the "Mediator" and "CQRS" patterns without a headache.
If you're using .NET Core and you feel like your project is becoming a "spaghetti code" mess, give MediatR a try. It’s a small library that makes a big difference.
Have you used MediatR before? Or do you have another favorite library for keeping your code clean? Let me know in the comments! 👇