Building a Custom Domain Events Dispatcher in .NET
Milan Jovanović
0:00 / 0:00
Building a Custom Domain Events Dispatcher in .NET
13 432 просмотра · 1 год назад
Milan Jovanović
167 тыс. подписчиков
13 432 просмотра · 1 год назад
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
Get the source code here: / milanjovanovic
Thinking of removing MediatR from your .NET application?
In this video, I show you how I built a custom domain event dispatcher to replace MediatR’s IPublisher.Publish functionality — without breaking my application layer.
You’ll learn:
How MediatR handles domain events under the hood
How to define IDomainEvent and IDomainEventHandler interfaces
Wiring up the dispatcher with EF Core and SaveChangesAsync
Using reflection and scoped DI to invoke handlers
Trade-offs (performance, type safety, complexity)
Whether you're building a Clean Architecture app or want more control over your CQRS stack — this guide will help you move away from third-party dependencies like 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 How Domain Events Work
2:42 Creating IDomainEventHandler
4:37 Adding Handlers in DI
6:47 Creating DomainEventsDispatcher
13:51 Testing the Implementation