0
votes

I got a WPF client application that connected to a wcf service reference.

My models are from the service reference only.

I want to create a viewmodel for each model, how can i add NotifyPropertyChangedEvent without adding each property manually from the model to the viewmodel

I saw in mvvm light , that the model can ineherit from ObservebleObject, only problem is that the model is created else where and i'm just getting the reference.

Any ideas ?

Thanks

2

2 Answers

1
votes

Everytime you call a method on your service, it's going to return a new DTO. It will never give you the same instance back, and you can't use a service to manipulate one object instance - all data used in communication is transient.

So those instances can never be updated (they're not models) so implementing INotifyPropertyChanged would be pointless. Instead you need to write a view model and copy your DTOs into that. The view model is where you would implement INotifyPropertyChanged.

0
votes

I don't think it is must to put the implementation of INotifyPropertyChanged in Model. You can simply implement it in ViewModel.

Why your View needs to tell the Model (via ViewModel) that something has been changed ? I think it should only tell ViewModel that there has been a change. Then let View Model play with Model.