Using Domain Events To Build A Decoupled System The Scales
☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic
Scalability is important. And domain events can help you build a scalable system by allowing you to achieve a decoupled architecture. I'll show you how to use domain events and discuss the pros and cons of publishing domain events with EF Core.
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Read my Blog here:
https://www.milanjovanovic.tech/blog
Subscribe for more:
https://www.youtube.com/@MilanJovanovicTech
Chapters
0:00 The problem of coupling
0:43 Creating a DomainEvent base class
1:44 Adding the OrderCreatedDomainEvent
3:01 Adding the LineItemRemovedDomainEvent
3:50 Domain events naming convention
4:13 Entity class for raising domain events
5:14 Raising domain events in Order entity
6:27 Handling domain events with MediatR
9:11 How are we going to publish domain events?
11:09 Decision: Publishing BEFORE or AFTER persisting changes?
12:22 Publishing domain events with IPublisher