hey all, How do you name your DTOs? For example I...
# server
t
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
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
I do the same, but use
AlertView
instead of
AlertDto
i
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!