Reputation: 2017
My system has the language of a "Contact" which is a sort of "ghost user" that we have some information on - it's validation rules are slim and it's state is largely contact information. We also have a concept of a "User" which is a fully-vetted and registered user. Think of a "User" as a fleshed out "Contact".
The lifecycle we are trying to capture is that a "Contact" will be replaced by a "User" once someone registers with that "Contact"s information.
We have other aggregate roots in the system that make reference to a "ContactId" pointing to the UUID of a "Contact". When that "Contact" registers, we'd like to use a new concept of a "User" to represent them in the domain and the "User" now has it's own "UserID" UUID.
As a side note, we are using CQRS/ES for the overall architecture.
Thanks!
Upvotes: 2
Views: 156
Reputation: 13256
What you are describing is actually not that strange since it happens all the time.
You could have a ShoppingCart
that becomes a Quote
that becomes an Order
that becomes an Invoice
.
Trying to merge concepts usually leads to pain and suffering.
I suggest keeping them separate and handling them with their own life-cycle since they may seem very closely related by they certainly do appear to be concepts distinct from each other.
There may be a clue in your 'ghost user'. That is probably an entity/AR that you are after that hasn't been properly defined. There are going to be different ways of handling that concept depending on how it is being used. It may be as simple as a value object representing wither of the two source entities.
Upvotes: 2