hey all,
How do you name your DTOs? For example I have a
entity
called
Alert
and for CRUD operations I have a DTO to create, so I’m naming
AlertCreationDTO
but to update I can’t use
AlertCreationDTO
because some fields can’t be updated. So how you organize/name those DTOs?
j
Jukka Siivonen
04/20/2019, 9:10 PM
We (try to) use DTO only for return values, e.g AlertDto. To manipulate use verb, create or update AlertCreate and AlertUpdate. Very mildly inspired by CQRS pattern...
👏🏾 2
t
tddmonkey
04/21/2019, 8:24 AM
I do the same, but use
AlertView
instead of
AlertDto
i
Ian White
04/21/2019, 3:22 PM
i have a little annotation processor i wrote called
@PartialDataObjects
which automatically generates partial views for dtos with various fields shown/hidden from data classes. the convention i adopted for it is
TypeModel
, e.g.
CreateAlert
,
UpdateAlert
,
PartialAlert
, etc. i guess it could go the other way around too to organize alphabetically better!