At present we are Exposing database entities to the client, but that is not always a good idea. Sometimes you want to change the shape of the data that you send to client. For example, you might want to:
Remove circular references (see previous section).
Hide particular properties that clients are not supposed to view.
Omit some properties in order to reduce payload size.
Flatten object graphs that contain nested objects, to make them more convenient for clients.
Avoid "over-posting" vulnerabilities. (See Model Validation for a discussion of over-posting.)
Decouple your service layer from your database layer.
DTO will help us to resolve all the above issues. In this video we will understand it in details. .
You can support me by donating on
www.buymeacoff...
Thanks
Studymash
14 окт 2024