Converting a model to a DTO with an operator in C#
I have a model class representing 1 entity for 1 table in the database, and I need to convert it into a DTO class to respond to the client. Usually you’d define a ToDto method to convert, or use automapper. But today I have another way, which is using the explicit operator.
Example:
1 | namespace ConsoleApp; |
Converting a model to a DTO with an operator in C#
/en/lap-trinh/Chuyen-model-ve-DTO-bang-operator-trong-C/
Comments
Comment plugin failed to load
Loading comment plugin