I'm currently writing viewmodels for my (WPF/C#) app.
I have to do a lot of copy and paste though. Isn't there a way to generate the viewmodel from the model like generating the model from the database?
I haven't found anything about it on the net ...
Have a look at Karl Shifflet's XAML Power Toys. It's a Visual Studio plugin which includes various helpers for developing WPF or Silverlight applications. One of the features is exactly what you're looking for:
- Create ViewModel Class - from a VB.NET or C# code window, easily create a ViewModel stub that includes commands and exposed data class. Optionally you can elect to re-implement all Model properties on the ViewModel.
Maybe have a look at automapper. This would at least save you from manually copying the properties between viewmodel and model.