I have one bounded conext, offers, that has Offers as root aggregate and Items as child entity.

I have another bounded context, products, which has Products as root aggregate, Providers as another root entity... but for the example Products is the entity that I need.

Product has a price property, that is the reference price that a product is sold. So when I add a new item to the offer, is this price which is set as default.

My offer is created in a first state, created, in which I can edit the offer, add new items, update items and so on.

I would like that if I change the price in a product, I would like to update the price in all the items of this product in all the offers which state is created.

How could I ensure that all the data is coherent after changing the price i the product, because they are two different bounded context, and two different aggregate roots, so from products I can't update the items of an offer when I call the update method in the product entity.

Also, I am organizing my project in modules according to the folder by feature (folder by bounded context) point of view, instead of folder by type, I think it is more clear. It is possible to see different opinions here: Folder-by-type or Folder-by-feature

So my project is organize in this way:

  • MyProject.Products.AplicationLayer

  • MyProject.Products.Domain

  • MyProject.Products.Repository

  • MyProject.Orders.AplicaionLayer

  • MyProject.Orders.Domain

  • MyProject.Orders.repository

I guess I have to have a higher layer or service that has a repository with offers, items and products, and do all in a same transaction. But in this way, I have a service only to update the price and the rest of the logic about products are in its own project, so the code is in many places, and I would like to avoid this.

Perhaps I have defined in a wrong way my bounded context, perhaps I could have a product entity in the offers bounded context only with the price, to only can modify the price that is the data that it is needed for the offer, but I think that this could make to update part of the product outside from many bounded context and i am not if it is correct.

Also with this solution, I don't see clear how could I update both entities in a coherence way, because I still would have two repositories, one for the root aggregate Offers and another repository for the root aggregate Products, because if I am not wrong, the recomendation it is to have one repository for each root aggregate, so in this case, no matter if I have a root aggregate Products in the bounded context of Offers, I still would have two repositories, and the main problem is how to ensure the transaction.

Or perhaps prices it wouldn't be a property of Products entity, because the price is more data that belongs to contability or sells (Offers in this case), more than products. But still I would have the problem to have two repositories for two root aggreagates.

I summary, I would like to know how could I update the price of the items in created offers when I update the price in the product.


  • Bounded Contexts are language barriers. When something has a different meaning to different people, you stumbled upon a different context. A product could mean different things to sales people (price) and warehouse managers (stock). In your question you say you have Products and Offers bounded contexts, but that doesn’t make sense to me.
    – Rik D
    Commented Feb 23, 2023 at 18:26
  • So, if I buy an item for $100 today, and next year you lower the price to $75, will your order record tell you that I paid you $75? Because that's what you're asking for, and I cannot think of any business case in which this is a wise idea. If anything, this is precisely the example I use when showcasing when one should copy a current value and not a join lookup relationship.
    – Flater
    Commented Mar 27, 2023 at 5:26

2 Answers 2


How could I ensure that all the data is coherent after changing the price i the product, because they are two different bounded context, and two different aggregate roots, so from products I can't update the items of an offer when I call the update method in the product entity.

You can add a publish/subscribe mechanism to your Products AR, for example by implementing the Observer pattern.

As the Orders AR already needs to have some knowledge of Products to know the current price of an item when it gets added to the Order, the Item could register itself with the Product to receive price updates. When a notification of a price update is given, the Item can execute some logic to determine if it will take over the new price or not.

  • I will see this pattern, but I have doubt. could it lead to an incoherence state? For example, if the price is changed very quick two times, could some intems to have a price and another items another prices after the second change? Commented Feb 23, 2023 at 12:29
  • @ÁlvaroGarcía, Regardless of what you do, there will always be a time period, maybe just a few nanoseconds, in which the prices are inconsistent. The Observer patterns can be implemented that the notification happens synchronously. Commented Feb 23, 2023 at 13:03

Who is reponsible for the price? The offer or the product?

If it is the product, don't store the price in the offer. If it is the offer, don't change the price in the other offers.

  • I am storing the price in the product the actual price, but I store the price in the offer too, that is the price that the product had in the moment to create the offer, so it can´t be changed never. However, the price in the product is the actual price, and can be change increasing or decreeasing, according to the circunstances. In summary, I guess i need the price in both places, in the offer and in the product. Commented Mar 27, 2023 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.