1
在服務器端,我有下面的類:RIA:如何獲得的功能,而不是一個數據
public class Customer
{
[Key]
public int Id { get; set; }
public string FirstName { get; set; }
public string SecondName { get; set; }
public string FullName { get { return string.Concat(FirstName, " ", SecondName); } }
}
的問題是,每場計算,傳輸到客戶端(在Silvelight應用程序),例如'FullName'屬性:
[DataMember()]
[Editable(false)]
[ReadOnly(true)]
public string FullName
{
get
{
return this._fullName;
}
set
{
if ((this._fullName != value))
{
this.ValidateProperty("FullName", value);
this.OnFullNameChanging(value);
this._fullName = value;
this.RaisePropertyChanged("FullName");
this.OnFullNameChanged();
}
}
}
而不是數據傳輸(即流量消耗,在某些情況下,它會引入大量開銷)。我想在客戶端進行計算(silverlight aplpication)。
這可能沒有手動重複的財產執行?
謝謝。
假設這是一個Web表單或其他東西,你不能使用AJAX或JavaScript進行驗證嗎? – 2010-03-28 22:16:55
我很抱歉,...我能做些什麼與驗證?功能複製的目的是在不傳遞FullName屬性值的情況下,在FirstName =「Alex」和SecondName =「Sereda」的情況下,在客戶端計算並顯示FullName爲「Alex Sereda」。 – Budda 2010-03-29 15:03:07