etsuba
etsuba

Reputation: 151

Merging two domain objects

In the project I'm working on, we have an aggregate domain object. The factory object handles the creation of the unique id for the object. But there is a separate import process which creates the same object initially without the id. To add the imported object to the system, we are now forced to do a field by field copy to a new object since we can't just set the id for it for obvious reasons. Could anyone suggest a better way of handling this situation?

Upvotes: 1

Views: 224

Answers (1)

moffdub
moffdub

Reputation: 5314

Possibilities:

  • If the import process allows it, inject your domain object when it is creating so it actually populates your object.
  • Have your object's implementation be a wrapper around the one created by the import process. Change your factory accordingly.

Upvotes: 1

Related Questions