I have 2 Aggregate Root:
One is the Lessor
user, and the other is the Lessee
user.
class Lessor extends AggregateRoot {}
class Lessee extends AggregateRoot {}
Each of these Aggregate Roots has a email
property, it is a Value Object.
class Email extends ValueObject { }
class Lessor extends AggregateRoot {
private email: Email
}
class Lessee extends AggregateRoot {
private email: Email
}
I am not sharing an instance of Email
, I am sharing the code of Email
.
Can I put the Email
code in the SharedKernel
folder?
- I didn't want to duplicate the
Email
code by placing it in theDomain
folders of each Aggregate Root. - And don't even put the
Email
code in one of the Aggregate Roots and import it in the other.
SharedKernel
folder is meant to be, then don't place it there, but maybe make some other shared folder. If you don't really have to coordinate with another team, then maybe rename that folder and place your code there. But ultimately, you (and your team) are free to organize your own code as you see fit.