我在Silverlight項目中使用Fody自動生成屬性的依賴。但是,如果setter已經包含RaisePropertyChanged
方法調用,則它不起作用。如何生成不INotifyPropertyChanged的Web服務的參考?
一種解決方法可以是無INotifyPropertyChanged
生成web服務參考碼,而是在部分方法實現它。
我怎樣才能不用INotifyPropertyChanged
Web服務引用的代碼?
我有一個WCF服務,讓我們稱之爲MaterialService.svc。它看起來是這樣的:
[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; }
}
當我添加的服務作爲服務引用,並生成客戶端代碼,每類設置爲實現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");
}
}
}
}
我怎麼能生成沒有按客戶端代碼't實施INotifyPropertyChanged
?
它的工作原理,非常感謝:)對於具有相同的問題,因爲我重新Fody任何人,我接觸西蒙Cropp,他做出支持現有的RaisePropertyChanged呼叫,這樣也解決了這一問題的新版本,但仍這是很好知道:) – 2012-08-14 07:43:06