I Removed MediatR – Building Your Own CQRS Handlers in .NET
Get the free Clean Architecture template: https://dub.sh/ca-template
Want to master Clean Architecture? Go here: https://bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: https://bit.ly/3SXlzSt
You've probably heard—MediatR is going commercial.
If you're using it in your Clean Architecture template (like I did), it might be time to explore alternatives. In this video, I’ll walk you through a full MediatR-free CQRS implementation using custom `ICommand`, `IQuery`, and handler interfaces.
✅ We’ll cover:
- Why I decided to remove MediatR
- How to build your own CQRS abstractions
- Replacing ISender with explicit handler injection
- Manual DI vs automatic scanning using [Scrutor](https://www.nuget.org/packages/Scrutor)
- Fully working Command & Query pipeline without third-party libraries
You'll see how to:
- Refactor a .NET API endpoint from MediatR to your own handler
- Register handlers manually and automatically
- Handle generic result types for commands and queries
👉 Want to skip ahead and use the updated template?
Check the pinned comment for a link to the Clean Architecture template without MediatR.
Check out my courses:
https://www.milanjovanovic.tech/courses
Read my Blog here:
https://www.milanjovanovic.tech/blog
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Chapters
0:00 Why MediatR and CQRS
1:44 ICommand and IQuery abstractions
4:33 Registering handlers with DI
5:21 Using handlers in endpoints (or services)
7:47 Completing the refactoring
10:32 A better way to register handlers with DI
13:55 The problem with cross-cutting concerns
Видео I Removed MediatR – Building Your Own CQRS Handlers in .NET канала Milan Jovanović
Want to master Clean Architecture? Go here: https://bit.ly/3PupkOJ
Want to unlock Modular Monoliths? Go here: https://bit.ly/3SXlzSt
You've probably heard—MediatR is going commercial.
If you're using it in your Clean Architecture template (like I did), it might be time to explore alternatives. In this video, I’ll walk you through a full MediatR-free CQRS implementation using custom `ICommand`, `IQuery`, and handler interfaces.
✅ We’ll cover:
- Why I decided to remove MediatR
- How to build your own CQRS abstractions
- Replacing ISender with explicit handler injection
- Manual DI vs automatic scanning using [Scrutor](https://www.nuget.org/packages/Scrutor)
- Fully working Command & Query pipeline without third-party libraries
You'll see how to:
- Refactor a .NET API endpoint from MediatR to your own handler
- Register handlers manually and automatically
- Handle generic result types for commands and queries
👉 Want to skip ahead and use the updated template?
Check the pinned comment for a link to the Clean Architecture template without MediatR.
Check out my courses:
https://www.milanjovanovic.tech/courses
Read my Blog here:
https://www.milanjovanovic.tech/blog
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Chapters
0:00 Why MediatR and CQRS
1:44 ICommand and IQuery abstractions
4:33 Registering handlers with DI
5:21 Using handlers in endpoints (or services)
7:47 Completing the refactoring
10:32 A better way to register handlers with DI
13:55 The problem with cross-cutting concerns
Видео I Removed MediatR – Building Your Own CQRS Handlers in .NET канала Milan Jovanović
cqrs cqrs event sourcing cqrs saga cqrs .net cqrs dotnet cqrs c# cqrs .net 6 cqrs rest api cqrs api cqrs ddd cqrs domain-driven design cqrs restful api cqrs .net 6 api cqrs .net 7 api cqrs microservice cqrs microservices cqrs .net microsevice cqrs .net microservices cqrs .net event sourcing cqrs mediatr cqrs mediator mediatr mediator clean architecture clean code software engineering design patterns .net core asp.net core cqrs vs saga
Комментарии отсутствуют
Информация о видео
13 мая 2025 г. 16:01:11
00:14:31
Другие видео канала