Milan Jovanovic Tech reposted this
Why do we use Domain Events? A domain event is something that happened in the domain, and other parts of the domain should be aware of it. I use domain events to notify other parts of my domain that something has happened. You can use domain events to build a loosely coupled system. Here's how: https://lnkd.in/ewA7miCr
How to deal with dbcontext issues when both, the command handler and the event handler have to perform saving db operations at the same time?
Useful tips
I feel like the real question of "why?" is from people who fear overarchitecting/cost to build. There's a time when it is overarchitecting to build out a domain event driven architecture. However, in a real world enterprise level system that's got any kind of lifetime or complexity to it, keeping the architecture separated by domain and connected via events that are emitted makes it much easier to scale teams, cloud hosting architecture, add/change features, etc. It also creates a feel within the code that mimics the workflow a business user would expect. It is incredibly helpful in handling faults gracefully as well. I feel like it's the original mentality from which agentic workflows in AI stem from and leverage, we just have been doing it without LLMs for a long time.
This is great. I'm always impressed by your work, mainly because the .NET community needs this level of professionalism and technical expertise. I remember, even 10 years ago, trying to introduce these concepts in the contexts where I worked and the frustration I felt—at least in the Italian market—seeing how average developers were so addicted to disorganized and unclean development models that all of this was viewed as alien.
I really like this approach. I have used it a lot in my projects. Especially integration events in microservice project. Great explained! Thanks Milan!
How do you document all domain events and their handlers of your application?
Practical .NET and Software Architecture Tips | Microsoft MVP
5dDo you want to simplify your development process? Grab my free Clean Architecture template here: https://bit.ly/4cPKDmp