Комментарии:
Super tutorial, Easy explained and precisely what I needed. Thank you!
ОтветитьBy C# conventions you should use "toDTO" instead of "asDTO" since the method returns a new object. The "as" word is used for when you want to imply that something is being casted AS something.
ОтветитьGreat tutorial! Is it possible to utilize extension methods for complex DTO mapping without any external libraries? Do you consistently employ extension methods for DTOs without relying on any other mapping libraries?
ОтветитьIs it possible to create Mapper for Mapping dto to Entity , reverse way
ОтветитьGreat !!! Using extension methods is the best way in a simple scenario .
ОтветитьFrom my long experience, it’s quite inconvenient and time-consuming to define all the transformations. Imagine if you have several dozens of DTOs, also, it’s inconvenient as you have to make all the transformations changes manually after refactoring. I believe, more standard approach is auto-mapping. The only thing I would consider would be embedding AutoMapper into the AsDto extension methods.
ОтветитьI prefer to use user-defined explicit conversion operators inside DTOs, instead of extension methods...
ОтветитьI have habit that I do not use DTOs for API return types, instead I call them Models, is this right or wrong?
Ответить