architecture - DTOs : Several DTO (and Assemblers) for the same resource -


I often need a single resource based on the cases of many DTOs.

For example, depending on what I want to display for the photo album, I will need different data in my DTO (creation through a form, list, description, etc.).

I have a collection of albums, an album, a collection of DTO albums, and an album for the album DetailDTO.

For each, I need a specific code.

Is it stupid?

Thanks, CA Benjamin

No, it does not look stupid.

The alternative of what you suggest is creating "Super-Dto" which is used for many purposes. And on which only some fields are used for each purpose.

It quickly becomes ugly and inadvertent, because DTO grows bigger and it is not clear what area is necessary for that purpose. Refactor and hard to understand.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -