Why do we use DTOs in our APIs?

  Рет қаралды 9,095

Codewrinkles

Codewrinkles

Күн бұрын

Пікірлер: 21
@fadidib8516
@fadidib8516 2 жыл бұрын
Great Channel, I love the deep dive of information.
@donmikkodanm.olmillo8154
@donmikkodanm.olmillo8154 3 жыл бұрын
Thank you for this video. It really helped me cleared about why we need to map it into DTOs. To put it on simple words, DTOs are much more flexible, and it is towards more on the client-side where the end user will modify or get the data. I've also heard from my mentors that you can also combine two domain models into one DTO but that is more on advanced one.
@Codewrinkles
@Codewrinkles 3 жыл бұрын
Tes, on the DTO you can combine what ever you want. A DTO is basically an aggregate of different data that will be consumed by the clients of the API. Id doesn't have to match 1 to 1 with your domain model classes.
@juliancavallo
@juliancavallo 3 жыл бұрын
Thank you for this video man, I always had doubts about DTOs and now it's all clear. Keep up the good work!
@Codewrinkles
@Codewrinkles 3 жыл бұрын
I'm glad it helped you clear up the reasons why we use DTOs.
@godfather7695
@godfather7695 11 ай бұрын
11:50 you may initialize ICollection by emty List or array and there is no possible nullref ex anymore
@shaileshkuswaha1126
@shaileshkuswaha1126 2 жыл бұрын
Such a Amazing tutorial. Thank you
@arunbm123
@arunbm123 2 жыл бұрын
really amazing informative Video..Thank u
@alfonsdeda8912
@alfonsdeda8912 Жыл бұрын
Hi, nice video! Two questions: -I created the service class that access the database with ef core, service's methods work with entities db, this service is called from the controller in api, so should i do mapping in service or controller? -if i want different dtos of same object from the same controller should i do two different endpoints? Thanks in advance.
@ahmedalhallag3338
@ahmedalhallag3338 2 жыл бұрын
The cleanest video on DTOs! A sub from me
@Codewrinkles
@Codewrinkles 2 жыл бұрын
I'm glad. I'm not sure why but it seems there is a lot of confusion and misunderstanding regarding DTOs. I'm happy this video cleared up some aspects for you.
@abdullokh_tolibjonov
@abdullokh_tolibjonov 2 жыл бұрын
thanks a lot :) was vey useful dont stop :)
@steve-o2198
@steve-o2198 Жыл бұрын
Using linq/list projection would be better and cleaner solution to mapping entities to dtos instead of doing loops.
@abdulwahabkhan4316
@abdulwahabkhan4316 2 жыл бұрын
very well explained :)
@krisztianistvancsato5940
@krisztianistvancsato5940 2 жыл бұрын
Nicely structured. Very clear. Great stuff. Thanks a lot! Just one question: Is there a way to connect my domain models and my dtos? So let's say, that I need to change some properties, for example in one of my domains. I'd like, if it automatically changed it in the related dto or it offered me the option. Thanks in advance.
@Codewrinkles
@Codewrinkles 2 жыл бұрын
AutoMapper mapping is a one-off action. If something changes automatically in your domain model after the mapping, the change will not automatically be replicated into your DTO. If you want to achieve something like that you might need to work with evens and re-do the mapping when certain events are raised. I am not aware of anything else to achieve your goal.
@krisztianistvancsato5940
@krisztianistvancsato5940 2 жыл бұрын
@@Codewrinkles I guess that can be an idea for a personal project, right? ;-) Once again, thank you very much for the excellent video.
@vu5700
@vu5700 2 жыл бұрын
Great video sir :)
@royvethanayagam5888
@royvethanayagam5888 3 жыл бұрын
Superb.
@Codewrinkles
@Codewrinkles 3 жыл бұрын
Thank you! Cheers!
@TheNefelin
@TheNefelin 9 ай бұрын
is this project on GitHub?
JAVA DTO Pattern Tutorial | Simplify Your Code
19:12
Amigoscode
Рет қаралды 219 М.
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Война Семей - ВСЕ СЕРИИ, 1 сезон (серии 1-20)
7:40:31
Семейные Сериалы
Рет қаралды 1,6 МЛН
УЛИЧНЫЕ МУЗЫКАНТЫ В СОЧИ 🤘🏻
0:33
РОК ЗАВОД
Рет қаралды 7 МЛН
Every team from the Bracket Buster! Who ya got? 😏
0:53
FailArmy Shorts
Рет қаралды 13 МЛН
Clean architecture with CQRS and MediatR in Asp.Net Core
42:24
Codewrinkles
Рет қаралды 16 М.
Use Data Transfer Objects (DTOs) in .NET the Right Way 🚀
6:48
Self-Taught Programmers... We need to talk.
7:37
Kenny Gunderman
Рет қаралды 27 М.
How To Use DTOs In .NET REST APIs
14:18
Julio Casal
Рет қаралды 21 М.
Error handling strategies in ASP.Net Core APIs
18:20
Codewrinkles
Рет қаралды 6 М.
Don't Use AutoMapper in C#! Do THIS Instead!
16:17
Codewrinkles
Рет қаралды 71 М.
Why use DTOs (Data Transfer Objects)?
7:23
CodeOpinion
Рет қаралды 74 М.
5 Rules For DTOs
17:56
Ardalis
Рет қаралды 46 М.
Data Transfer Objects - What Are DTOs - Full PHP 8 Tutorial
13:03
Program With Gio
Рет қаралды 43 М.
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН