INotifyPropertyChanged in WCF DataContracts

I make some WCF services, and some of them are Prism applications.

In order not to copy the DataContract class to the client side class, they would like to have INotifyPropertyChanged contract support.

However, I have several clients that are MVC3 clients.

Adds INotifyPropertyChanged support to data contracts that will obfuscate them?

In addition, I plan that my DataContracts will also be my POCO objects from my Entity Framework db connection. Will INotifyPropertyChanged be confusing?

Or is it INotifyPropertyChanged only for WPF, and other applications will not care about it?

+6
source share
2 answers

Or is it INotifyPropertyChanged only for WPF, and other applications will not care about it?

INotifyPropertyChanged is just an interface that you can implement on your objects without messing up anything. It is used as primary with WPF and Silverlight, and it will not affect other technologies that do not use it. Thus, there should not be any problems with its implementation in your contracts with WCF data. Note that when creating a strongly typed client proxy from this WCF service (using svcutil.exe or Add Service Reference), the resulting objects will not implement this interface. They will be POCOs.

+9
source

Another option is to use MVVM in WPF applications. The DataContract will be Model (M), and the WPF application developer will need to create the ViewModel.

ViewModel must implement INotifyPropertyChanged and load its data from the Model.

+1
source

Source: https://habr.com/ru/post/892061/


All Articles