Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for examples of Domain Events

Does any one know where to find example code for an implementation of Domain Events as described by Udi Dahan in Domain Events – Salvation?

like image 881
Roman Avatar asked Dec 31 '10 10:12

Roman


People also ask

What are domain events used for?

A domain event is, something that happened in the domain that you want other parts of the same domain (in-process) to be aware of. The notified parts usually react somehow to the events. An important benefit of domain events is that side effects can be expressed explicitly.

What is a domain event in DDD?

A Domain Event is an event that is spawned from this model that is a result of a decision within the domain. Within the model our Aggregates have the role of maintaining business rules and this is where we implement decision points in our model, so the Aggregates are also responsible for creating the Domain Events.

What is domain-driven design example?

An aggregate is a domain-driven design pattern. It's a cluster of domain objects (e.g. entity, value object), treated as one single unit. A car is a good example. It consists of wheels, lights and an engine.


2 Answers

A better implementation of Domain Events, in my opinion, can be found at https://github.com/bsommardahl/BlingBag. There's a sample application and implementation instructions. I like this implementation more because it doesn't use the static class to raise domain events and doesn't couple your domain to your infrastructure. Instead it uses plain ole c# events and initializes them in the services that return your domain entities (like your repository or a fetcher service).

like image 89
Byron Sommardahl Avatar answered Sep 18 '22 15:09

Byron Sommardahl


DDDSample.Net has one.

like image 44
Arnis Lapsa Avatar answered Sep 18 '22 15:09

Arnis Lapsa