Creating a DTO from an Object

I want to auto generate some DTOs from some of my existing objects, I was wondering if there are already existing open source Resharper, DevExpress or VSX versions, I need a tool to view my code and let me choose which properties I want to enable into your DTO, and then generate a class based on this ...

+7
visual-studio-2008 code-generation resharper vsx devexpress
source share
2 answers

This is a kind of hack, but you can use Visual Studio / Resharper to extract the interface from the class, then create a DTO class and get from the interface, and then use Visual Studio to automatically inject the interface elements (then, if desired, remove the interface).

+5
source share

Another opinion is to use the reflection code in the T4 template.

T4 templates are one of the powerful hidden features of Visual Studio.

Take a look here to see how easy it is to get started with T4.

+7
source share

All Articles