Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing INotifyChanged on DataContracts
    primarykey
    data
    text
    <p>I'm trying to separate actual service data from service functionality and am therefore returning data as a data contract which holds several properties (data members). The client code is generated using svcutil /edb which also generates an INotifyPropertyChanged implementation for the proxy code. As far as my testing revealed, that code does not invoke the PropertyChanged event for changes which happened on the server. Additionally, getting a property does only return the property value as when the data contract proxy has been obtained.</p> <p>Basically, here is what I've got:</p> <p>(Server Side)</p> <pre><code>[ServiceContract] public interface IControllerService { [OperationContract] DataModel GetDataModel(); } [DataContract] public class DataModel : INotifyPropertyChanged { private string _state; [DataMember] public string State { set { if (_state != value) { _state = value; OnPropertyChanged("State"); } } get { return _state; } } public event PropertyChangedEventHandler PropertyChanged; [OperationContract] protected virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } </code></pre> <p>(Client Side)</p> <pre><code>private void Test() { ControllerServiceClient client = new ControllerServiceClient(); DataModel model = client.GetDataModel(); model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(DataModelChanged); Console.WriteLine(model.State); // ... invoke something that forces the server to change the data model // Output stays the same Console.WriteLine(model.State); } private void DataModelChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { // This method never get called for server-side changes } </code></pre> <p>I expect that the data contract proxy acts as a transparent proxy to the server's data contract but it seems to be completely unbound.</p> <p>Thanks very much beforehand, Cheers,</p> <p>Romout</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload