Skip to main content
There is no "DTO pattern", removed that and streamlined some other glitches
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

When to use entity and when to use DTO's - DTO PatternDTOs

Hi I am very new to DTO patternusing DTOs, and I am starting to understand it slowly, but there are still some missing puzzles for me.

I understand the use of DTO'sDTOs in the way of decoupling the persistence data model from the data model (representation) offered to the consumers. Also, that the aim beneath DTO'sDTOs is to gather in a single response as much info as necessary for clients to save calls to the server.

What I am having a hard time with is understanding what is the best situation to use DTO's compared to use of an entity?

To make it more clear when do I use an entity and when a DTO?

For example when I am trying to save new user in database should I use a DTO or an entity?

For retrieving data from a database and communicating with a frontend in that case only, will I make use of DTO'sDTOs?

When to use entity and when to use DTO's - DTO Pattern

Hi I am very new to DTO pattern, and I am starting to understand it slowly, but there are still some missing puzzles for me.

I understand the use of DTO's in the way of decoupling the persistence data model from the data model (representation) offered to the consumers. Also, that the aim beneath DTO's is to gather in a single response as much info as necessary for clients to save calls to the server.

What I am having a hard time with is understanding what is the best situation to use DTO's compared to use of entity?

To make it more clear when do I use entity and when DTO?

For example when I am trying to save new user in database should I use DTO or entity?

For retrieving data from database and communicating with frontend in that case only use of DTO's?

When to use entity and when to use DTOs

Hi I am very new to using DTOs, and I am starting to understand it slowly, but there are still some missing puzzles for me.

I understand the use of DTOs in the way of decoupling the persistence data model from the data model (representation) offered to the consumers. Also, that the aim beneath DTOs is to gather in a single response as much info as necessary for clients to save calls to the server.

What I am having a hard time with is understanding what is the best situation to use DTO's compared to use of an entity?

To make it more clear when do I use an entity and when a DTO?

For example when I am trying to save new user in database should I use a DTO or an entity?

For retrieving data from a database and communicating with a frontend, will I make use of DTOs?

Source Link
user9347049
  • 137
  • 1
  • 1
  • 5

When to use entity and when to use DTO's - DTO Pattern

Hi I am very new to DTO pattern, and I am starting to understand it slowly, but there are still some missing puzzles for me.

I understand the use of DTO's in the way of decoupling the persistence data model from the data model (representation) offered to the consumers. Also, that the aim beneath DTO's is to gather in a single response as much info as necessary for clients to save calls to the server.

What I am having a hard time with is understanding what is the best situation to use DTO's compared to use of entity?

To make it more clear when do I use entity and when DTO?

For example when I am trying to save new user in database should I use DTO or entity?

For retrieving data from database and communicating with frontend in that case only use of DTO's?