7

I want to auto gen some DTOs from some of my existing objects, I was wondering if there already exist a Resharper, DevExpress or VSX open source to use, I need a tool to look into my code and let me choose which properties I want to include in my DTO and then generate a class based on that...

Filip
  • 3,257
  • 2
  • 22
  • 38
Ali Shafai
  • 5,141
  • 8
  • 34
  • 50

2 Answers2

7

Another opinion would be to use some reflection code in a 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.

Alex James
  • 20,874
  • 3
  • 50
  • 49
5

This is kind of a hack but you could use Visual Studio/Resharper to Extract an interface from the class, then create a DTO class and derive from the interface, then use Visual Studio to auto implement the interface members (then, optionally remove the interface).

NotDan
  • 31,709
  • 36
  • 116
  • 156
  • Interesting approach, but I could also copy the class and remove not wanted elements. I was after a clean and fast way of doing it over and over again... – Ali Shafai May 07 '09 at 02:18