How to generate web service reference without INotifyPropertyChanged?
.net, c#, inotifypropertychanged, silverlight, wcf
Solution
After you add the service reference, open the file `Reference.svcmap` under the service reference (you may need to enable the "show all files" option in the "Project" menu). There find the `<EnableDataBinding>` element, and change the value to false. That will remove the `INotifyPropertyChanged` from the generated data contracts.
Problem
I am using Fody in a SilverLight project to auto-generate property dependencies. However, it doesn't work if setters already contain a `RaisePropertyChanged` method call. A workaround could be to generate web service reference code without `INotifyPropertyChanged` and instead implement it in a partial method. How can I generate web service reference code without `INotifyPropertyChanged`? I have a WCF service, let's call it MaterialService.svc. It looks something like this: ``` [ServiceContract] public interface IMaterialService { [OperationContract] Material GetMaterial(int id); } [DataContract] public class Material { [DataMember] public int ID { get; set; } [DataMember] public string Name { get; set; } } ``` When I add the service as a Service Reference and generate client code, every class is set to implement `INotifyPropertyChanged`: ``` public partial class Material : object, System.ComponentModel.INotifyPropertyChanged { private int IDField; private string NameField; [System.Runtime.Serialization.DataMemberAttribute()] public int ID { get { return this.IDField; } set { if ((this.IDField.Equals(value) != true)) { this.IDField = value; this.RaisePropertyChanged("ID"); } } } [System.Runtime.Serialization.DataMemberAttribute()] public System.Nullable<string> Name { get { return this.NameField; } set { if ((this.NameField.Equals(value) != true)) { this.NameField = value; this.RaisePropertyChanged("Name"); } } } } ``` How can I generate client code that doesn't implement `INotifyPropertyChanged`?