Hi. Thanks for share you knowledge. I have a question about the responses when it comes from query side. Why always do you map in the query response the dto with the same entity with the same parameters. What it's the reason, instead of reaturn the query result with the entity type . Thanks
I am a software design engineer having experience on design and developing software systems. My favorite development tools are Java, Spring Boot and JS technologies.
The reason is that your entity might have more parameters and your client doesnt need all those parameters. So, you create a DTO of what parameters your client want. For an example, client wants only name and age of an user. However, your entity has more information than that like telno, address, designation etc. Therefore, in order to provide what client wants, you create your custom DTO that contains only name and user property.
I understand. But in the case of return the same properties. It should be better return the entity instead of "duplicate " the object contract? Thank for the response.
I am a software design engineer having experience on design and developing software systems. My favorite development tools are Java, Spring Boot and JS technologies.
Hi. Thanks for share you knowledge. I have a question about the responses when it comes from query side. Why always do you map in the query response the dto with the same entity with the same parameters. What it's the reason, instead of reaturn the query result with the entity type . Thanks
The reason is that your entity might have more parameters and your client doesnt need all those parameters. So, you create a DTO of what parameters your client want. For an example, client wants only name and age of an user. However, your entity has more information than that like telno, address, designation etc. Therefore, in order to provide what client wants, you create your custom DTO that contains only name and user property.
I understand. But in the case of return the same properties. It should be better return the entity instead of "duplicate " the object contract? Thank for the response.
You can do that if you need to return exact entity.