Sharing IDs between bounded contexts

185 views
Skip to first unread message

Jack Snow

unread,
Nov 27, 2017, 6:41:22 PM11/27/17
to DDD/CQRS
Hi,

I have a few scenarios regarding sharing IDs between bounded contexts and I'd like to hear what you guys think.

1. In the system, there is a Customer AR (CRM BC) and a Staff AR (Collaboration BC). In both cases, the CRM BC and Collaboration BC are the owners of those aggregates as the aggregates should be created there first. There is also an identity BC that deals with authenticating these Users into the system. For staff, they can log in to the system. For Customers, they can optionally create an account to log in via the website to view and update their account. Question: should the Users in the Identity BC have their own ID, or should it just use the ID from the Customer AR and the Staff AR? The IDs are UUIDs and collision will not be a problem.

2. The system has a requirement where administrators can define custom fields and objects for Customers and Staff. The definition of these fields and objects will be in Custom Fields BC. The values for these custom fields needs to be linked to each corresponding Customer or Staff. Each Customer or Staff should only have 1 set of values for these custom fields (a 1-to-1 relationships). In this case, should use Customer or Staff ID for Values AR in this BC? Or should I assign an ID for the Values AR and link it to the Customer or Staff via their Customer or Staff ID? It does seem a bit odd as the custom field values is not exactly a customer or staff.

Thanks!

Samuel Francisco

unread,
Nov 6, 2018, 2:14:51 PM11/6/18
to DDD/CQRS
For item 1, you shoud have an UserId property on Customer AR and Staff AR, reference the id of User AR.
For item 2, you shoud have the same UserId property on Values AR, if an user can not be an Customer and an Staff at the same time.
In the case the user can be an Customer and Staff at the same time and have a set of fields for each profile, you shoud have two types of profiles, one for Custoners with an CustomerId property and another for Staffs with a StaffId property.
Reply all
Reply to author
Forward
0 new messages