代码
public class Order : XPObject {
public Order() {}
public decimal UnitPrice;
public int Qty;
public decimal Discount;
[PersistentAlias("UnitPrice*Qty*(1-Discount)")]
public decimal ExtendedPrice {
get { return Convert.ToDecimal(EvaluateAlias("ExtendedPrice")); }
}
}
public Order() {}
public decimal UnitPrice;
public int Qty;
public decimal Discount;
[PersistentAlias("UnitPrice*Qty*(1-Discount)")]
public decimal ExtendedPrice {
get { return Convert.ToDecimal(EvaluateAlias("ExtendedPrice")); }
}
}
代码
[PersistentAlias("TaskWork[].Sum(HoursSpent)")]
public float HoursSpent {
get { return (float)(EvaluateAlias("HoursSpent") ?? 0f); }
}
public float TotalHours {
get { return RemainingHours + HoursSpent; }
}
[Association, Aggregated]
public XPCollection<TaskWork> TaskWork {
get { return GetCollection<TaskWork>("TaskWork"); }
}
public float HoursSpent {
get { return (float)(EvaluateAlias("HoursSpent") ?? 0f); }
}
public float TotalHours {
get { return RemainingHours + HoursSpent; }
}
[Association, Aggregated]
public XPCollection<TaskWork> TaskWork {
get { return GetCollection<TaskWork>("TaskWork"); }
}