Should DTOs contain other DTOs or does it mean "behavior"?

We are starting a new project and developing DTOs that will be injected into the corresponding POCOs with behavior. However, every DTO example I can find contains only value types such as:

public class CustomerDTO
{
  public int Age { get; set; }
}

      

But we would like to add DTO properties that reference collections of other DTOs, for example:

public class CustomerDTO
{
  public List<AddressDTO> Addresses { get; set; }
}

      

Is this a bad design idea that will give us problems down the line? Or is there no other way to design real DTOs that don't reference each other?

+3


source to share


1 answer


These are the typical navigation properties that you want to add to a DTO. I think this is correct and the only problem you may come across is circular references in serialization, etc.



0


source







All Articles