I'm getting confused on how to define bounded contexts where there are shared concerns between them, and how to represent this with Domain Entities.
For example: A customer has many pro开发者_Go百科ducts in a Customer context A company has and a list of products in the Company context
So the customer is managed via the customer context, and the company via the company context
Given the contexts are in differnt modules.
If I want to provide the Company's address details with a product, how should this be handled?
Do I reference the module containing the Company context in the module containing the customer, or do I create a Company entity in the customer context specifically for use when interacting with customers?
Thank you
You can have different representations of the same entity in different bounded contexts. Company in Company
BC can be very different from company in User
BC. All they have to share is some kind of correlation Id.
This is how we approached it in our project as well.
For one bounded context we used a contract as an Aggregate Root, while in another bounded context we used the contract as a value object/entity
In the first module/BC we had a big contract class with a lot of behavior in it, while in the second module/BC we had another contract class, which only contained a few properties with private setters.
This way it would be possible to separate the 2 BC's into separate assemblies of services in a SOA design even.
精彩评论