おおよそ次のようなモデルがあります。
private bool IsProduct {get; set;}
private decimal ProductPrice {get; set;}
private decimal TimedRate {get; set;}
public decimal SingularAmount {
get {
if (this.IsProduct) {
return ProductPrice;
}
else {
return TimedRate;
}
}
set {
if (this.IsProduct) {
this.ProductPrice = value;
}
else {
this.TimedRate = value;
}
}
}
この SingularAmount プロパティを RIA Services 経由で Silverlight 3 DataGrid にバインドしています。私が見つけたのは、プロパティを変更すると、モデルのそれぞれのプロパティが更新されないということです。コードをステップ実行すると、クライアント側で、たとえば SingularAmount が 5 に設定されていることがわかります。他のプロパティは更新されません。
RIA がクラスのクライアント側バージョンを作成するとき、この種の機能は移植されていないようです。これに取り組む方法についてのアイデアはありますか?
アップデート
以下は、そのプロパティの RIA 生成コードです。
[DataMember()]
public decimal SingularAmount
{
get
{
return this._singularAmount;
}
set
{
if ((this._singularAmount != value))
{
this.ValidateProperty("SingularAmount", value);
this.OnSingularAmountChanging(value);
this.RaiseDataMemberChanging("SingularAmount");
this._singularAmount = value;
this.RaiseDataMemberChanged("SingularAmount");
this.OnSingularAmountChanged();
}
}
}
明らかに、これは元のサーバー側のプロパティとはあまり似ていません。