Questions tagged [domain-events]

121 questions
3
votes
1 answer

Can domain event be raised in domain service?

I'm wondering if domain event can be raised in domain service? I've got such a code written in C#. Of course it works, but is it correct from DDD point of view? First example is related to user deletion. In my system Account has multiple users.…
3
votes
2 answers

Does exist application event term in DDD?

Domain events are well known in DDD, which can be published in Aggregate Roots or in Domain Services. My question here is, Can domain events be published in application services/use cases? For example, simplifying. I have an application service…
Mr. Mars
  • 522
  • 1
  • 5
  • 22
3
votes
1 answer

Handling a domain event in an asp.net mvc controller

I'm looking into using Domain Events to bubble information from operations occuring deep inside of my domain model in order to signal certain events at the controller level. Unfortunately, I haven't been able to find an example of how to properly…
DanP
  • 6,072
  • 4
  • 35
  • 65
3
votes
3 answers

Domain-Driven Design: how to model nested product category hierarchy? Even worse, what if the product category is an Aggregate Root?

I am practicing Domain-Driven Design so why not build a demo product catalog project? Apparently Product is the Core Domain here, but since I like to make the project more interesting, I would love to support nested Category hierarchy. In other…
3
votes
1 answer

Which Layer for Domain Events, EventHandlers, Dispatcher

I have been reading about Domain Events and have seen codes from Udi's implementation(http://www.udidahan.com/2009/06/14/domain-events-salvation/) ,Mike Hadlow (http://mikehadlow.blogspot.com/2010/09/separation-of-concerns-with-domain.html), Jimmy…
TheMar
  • 1,864
  • 2
  • 29
  • 51
3
votes
2 answers

Can an aggregate be part of a domain-event?

Consider an aggregate with many properties. For example UserGroup. If I want to publish a UserGroupCreatedEvent I can do 2 things: duplicate the properties from the just created UserGroup to UserGroupCreatedEvent and copy their values. OR: Refer to…
Pepster
  • 1,817
  • 1
  • 20
  • 35
3
votes
3 answers

Who is responsible for entity's mutation when domain event is raised? DDD

I've been learning about CQRS/ES. Looking at small example projects I often see events mutating the entity state. For instance If we look at the Order aggregate root: public class Order : AggregateRoot { private void Apply(OrderLineAddedEvent…
lexeme
  • 2,902
  • 9
  • 51
  • 112
3
votes
2 answers

DDD: Where to Place Domain Events

I just read Vernon's book "Implementing Domain-Driven Design". What I couldn't find is where to put your Domain Event's classes. In the same namespace as your aggregates? In a sub-module like .Events? Or a hybird: same…
David Rettenbacher
  • 4,870
  • 2
  • 33
  • 40
2
votes
1 answer

Queuing domain events in C#

This article describes a great pattern called 'Domain Events': http://www.udidahan.com/2009/06/14/domain-events-salvation/ One major flaw with this pattern however is highlighted in comment 27 by user Andy: If a transaction fails, we don't want our…
cbp
  • 23,600
  • 27
  • 118
  • 194
2
votes
2 answers

Application Events in DDD?

This question is similar to: Does exist application event term in DDD? , but I don't know how to apply the explanations given there to my specific issue. I have a SearchFilmUseCase and I want to raise an event FilmSearchedEvent once it finishes its…
2
votes
1 answer

DDD: Entity with collection of value objects - One event or multiple?

Imagine an instance where we have an entity that has a collection of value objects. If we were to add (say the domain concept is to assign) an additional record value object to the collection we would have something…
Steven
  • 633
  • 4
  • 13
2
votes
1 answer

Entity persitance inside Domain Events using a repository and Entity Framework?

I am delving into domain events and need some advice about persisting updates to an entity for history reasons. My example deals with a User entity and Signing In: public class UserService { private UserRepository _repository; …
DDiVita
  • 4,124
  • 2
  • 56
  • 110
2
votes
1 answer

Creating Command Inside a Domain Event Handler In CQRS

I have a simple scenario regarding CQRS and DDD in mind and I can't figure out the right way to implement it: Order and Buyer are two aggregate roots inside Ordering service. When a user checks out the basket: An integration event is raised in…
Gru97
  • 115
  • 1
  • 4
2
votes
1 answer

Is it possible to implement MediatR in the Aggregates (Domain Layer) without dependency injection (DDD)?

To prevent reinventing the wheel, I'd like to use MediatR in the Aggregates to publish domain events. (Un)Fortunately(?) MediatR works as a dependency that is injected into the classes, and not something that I can call statically. Therefore I'd end…
Jose A
  • 7,443
  • 8
  • 49
  • 77
2
votes
3 answers

DDD - Multiple Bounded Contexts because of differing aggregate data?

We try to split up our domain into bounded contexts with the goal to have a modular application design/architecture. We did an enlightening EventSorming session which helped us a lot to identify bounded contexts and its aggregates. After the…
1 2
3
8 9