I often find myself duplicating properties from my EF model classes in my view model classes, then decorating them with metadata annotations etc. to attach UI relevant information to them. I prefer using AutoMapper to map my data entities to view models, to inheriting my view models from the entity models or containing the entity model as a property inside the view model. I am just hoping somebody has a tool out there that can read a list of properties from one class and generate another class with the same properties.
I realise this is a very simple task, and will not balk at writing something myself, but I don’t want to reinvent the wheel.
prof (had left as a comment, but thought it more visible as a ‘suggestion’)
As you say, there must be a tool out there. I myself have (more times than i care to mention) opted to use T4 templating to accomplish this task. I basically just use it via a powershell script with a few command line parameters that tell it which model to use etc, etc along the lines of:
which would produce a viewmodel with a name along the lines of
MyModelEditViewModel(){}will be interested to see other approaches tho.