samedi 30 novembre 2019

Should DTOs have the same hierarchy of the original entity?

I am developing a restful APIs and we have animal kingdom entities where Animal is an abstract class and we have 2 sub-classes Dog and Cat.

Should the DTO has the same hierarchy as the original entities ? In other words, should I have AnimalDTO class, CatDTO class and DogDTO class ( where both Cat and Dogs inherits from animal )? Or I should have only Cat and dog DTOs that have all animal variables ?

Aucun commentaire:

Enregistrer un commentaire