ids across context

43 views
Skip to first unread message

opie

unread,
Jan 5, 2011, 5:56:54 PM1/5/11
to DDD/CQRS
Have you used the same ID for the same representation of an object in
a different context?
For example, I have a SoilSample AggregateRoot that exists in
'Operations' and a 'Testing' bounded contexts.

There are a handful of events that might be picked up by a handler for
firing commands into the other context (ie,
SoilSampleRequiresVerificationEvent being converted to
StartSoilSampleVerificationCommand).

Ordinarily I have been enriching the creation events with these
various ID's but I was thinking it would be easier to just have the
event storage split according to BC and use the same ID across the
boundaries. I can't have the same id on two different AR's in the same
store, of course.

I am using generated GUID's if it matters.

Is this just asking for trouble?

@seagile

unread,
Jan 6, 2011, 3:35:56 AM1/6/11
to DDD/CQRS
I'm assuming only one BC is "owner" of the id; the other BC just uses
it as a correlation identifier of a business concept. Maybe there's a
more natural key in your domain, if so, use that. I presume each soil
sample gets some kind of tracking number (i.e. how do the people that
do the soil verification differentiate between soil samples?).

opie

unread,
Jan 6, 2011, 8:58:47 AM1/6/11
to DDD/CQRS
In this case, yes, there is what is called a 'log number' for user
identification of samples. I am trying to avoid requiring these
additional bits in the events that exist only for tying related
concepts across BC's. Using the natural key would help, as you
suggest, to a degree though. thanks for your input.
Reply all
Reply to author
Forward
0 new messages