Alexis Pavlidis
I am a software engineer/craftsman. I am passionate about building working and well-crafted software.
Basically factories enable you to create Domain Objects
Let’s say we want to open a bank account. We need lots of software objects associated with each other. A factory can handle the creation of all these objects associated with the bank account.
What the factory generates is important, but how it happens has no relevance to your domain. But the result of the factories does matter to the domain.
An event is something that has happened in the past.
A domain event is, something that happened in the domain that you want other parts of the same domain to be aware of.
In the eShopOnContainers application, when an order is created, the user becomes a buyer, so an OrderStartedDomainEvent is raised and handled in the ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler
With event notifications, a message is always sent asynchronously and communicated across processes and machines.
However, with domain events, you want to raise an event from the domain operation you are currently running, but you want any side effects to occur within the same domain.
By Alexis Pavlidis
I am a software engineer/craftsman. I am passionate about building working and well-crafted software.