views:

362

answers:

2

Hi there,

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...

+1  A: 

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
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
+4  A: 

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
The link is broken.
Steven Sudit
It must have been an intermittent failure, its working again.
Alex James

related questions