I have a WPF application with MVVM, Entity Framework and a WCF service.
I have created Self-Tracking Entities so the entity classes already implement INotifyPropertyChanged.
Should I databind the properties of these classes directly (for example having a ObservableCollection<Author> Authors property in my main ViewModel) or should I create a ViewModel with the same properties (and having ObservableCollection<AuthorViewModel> Authors property in the main ViewModel) ?
Another question, not related to the title, but well.
Before using STE, I was using POCO classes for my entities, but they are not serializable and the the WCF service had trouble with that. Is there an easy solution ?
The recommended answer is to use
ObservableCollection<AuthorViewModel>, mainly because if any additional UI-specific logic needs to be implemented then that logic should be in a ViewModel, not a Model. In my experience, it’s always cleaner to wrap your model in a viewmodel, if only for consistency.