
In the recent past I have given talks about MVVM and talked to a lot of people about the inner workings of the pattern. One of the most heard complaints is the sheer amount of coding tasks that seem to repeat themselves over and over again. Implementing INotifyPropertyChanged, IEditableObject, mapping the Model to the ViewModel and back, adding Commands and oh boy, writing all the asynchronous method handlers. Let alone maintaining these.
On the web you’ll find many MVVM frameworks (ranging from light to scary) and many examples that take shortcuts and mix up the Model and the ViewModel. One of the solutions I have been giving for these worries consisted of a single sentence: “You might give it a shot to generate the ViewModel using T4 templates.” Every time I said this two things happened: 1. the other nodded (perhaps pretending to know T4) and 2. My brain started to get into gear thinking about how I would do that, knowing I would never do that. But this time the gears kept on turning so I decided to put my money where my mouth was. After many hours of experimenting, designing and coding I proudly present to you the first public version (still Alpha) of the MVMMapper.
Please read or better try the first tutorial and give me feedback.
3 comments
I should mention here that when you use RIA services, a lot of the stuff that is required to do things like validation is already being mapped between server and client. Thus eliminating the need to do this by hand. Depending of course on the requirement whether you want to add validation to the model or the viewmodel.
willemm
Very Cool!
I’ve experimented a bit and it really saves me quite some time 🙂
Thanks……
Alex van Beek
Willem, this generator is not comparable to the RIA Services. It does an entirely different job.
Erno de Weerd