So I have built a domain model and some logic into that. I have created two repositories for two aggregate roots.
My question is how to access to the reference data from these layers?. For example, say we have the following types
Our application entry points expect
Young as inputs. But, to validate and save this in the database (which has a foreign key to another table
PERSON_TYPE which has these 2 values), I need to convert these IDs to store aggregate roots.
Could I create a
PersonTypeRepository (in the domain layer) and use it when I persist my aggregate roots? Should this conversion happen in domain layer or should it happen in the application layer? For example, from a service
Edit: For now I have gone with this approach. From
controller I call
Assembler for the
DTO. I created a non-domain model repository (Infrastructure layer). Then from
Assembler I build the domain model (caveat is exposing
setMethods() of a domain model) using the