Where to raise persistence-dependent domain events – service, repository, or UI?

My solution is that you raise events in both Domain layer and service layer. Your domain: public class Order { public void ChangeStatus(OrderStatus status) { // change status this.Status = status; DomainEvent.Raise(new OrderStatusChanged { OrderId = Id, Status = status }); } public void AddNote(string note) { // add note this.Notes.Add(note) DomainEvent.Raise(new NoteCreatedForOrder { OrderId … Read more

Communicating between two Bounded Contexts in DDD

When integrating BCs, you have a few options. The reason that calling out to an external BC is discouraged is because it requires for both BCs to be operational at the same time. However, this is often quite acceptable and is simpler than the alternative. An alternative is to have the Game BC subscribe to … Read more