✨ Chuyển model về DTO bằng operator trong C#
Mình có một class model, đại diện cho 1 entity 1 table trong database, và cần chuyển nó về 1 class DTO để response cho client. Thường thì sẽ định nghĩa method ToDto
để convert hoặc xài automapper. Nhưng hôm nay mình có 1 cách khác, đó là xài toán tử explicit.
Ví dụ:
1 | namespace ConsoleApp; |
✨ Chuyển model về DTO bằng operator trong C#
lap-trinh/Chuyen-model-ve-DTO-bang-operator-trong-C/
Comments
Comment plugin failed to load
Loading comment plugin