Root entity reference to another root

I ran into a typical DDD problem. It should be very simple. I have an order and a customer. A customer can create several orders. The client is the root of its own unit. An order is the root of your own machine. But when a customer creates an order, we show some of the customer information in the order. Should the order fill out a customer link? When he holds it, then when the order repository receives the order, we can also get some of the customer information, as well as for display. But when we attract an order in a transaction, the client also falls into it, which creates a problem if the client also receives updated information at the same time. Please advise the guys! I feel that I do not want to refer to a customer on request.

  • Question 2: (NEW)

Can I get and keep a link to the Client (from the Client Repository) for this Order by creating an Order (using the Factory Order) and safely saving the Order (without updating the Client inside, in any case, is the Client only for information / request?), Without creating competition, if the same Client is modified where else? Suppose NHibernate is an ORM.

+3
source share
1 answer

The simple answer is that you hold a client identifier or, if necessary, for your domain, ValueObject with a minimum set of client information (ID, Name).

A more complex answer is to think about a limited context. See Eric Evans' presentation where he wanted him to put the chapter of BC as the first chapter of the book.

, AR , . Billinged Bounded Convert AR Customer .

+2

All Articles