DEV Community

[Comment from a deleted post]
Collapse
 
jofisaes profile image
João Esperancinha

Hi there!

Thanks for your comment! The id property is another paradigm that isn't strictly related with this architecture. You could add an Id, but I wouldn't add directly the one from the database. Maybe you could obfuscate it with some other technique. In any case, whether the id is present in de Dto or not, or if it should be there or not, is an independent architectural decision. Some projects use the id directly, but doing so, they are exposing the id to the outside world. Even if everything is protected and shielded against attacks, now everyone would know at least the ID of your objects. That could be a big step for hackers.

Hope this helps,
Cheers!