>This is probably more a plain old .NET question than MM.NET, but MM.NET may have some bearing on it.
>
>I have a Policy which has a date Paid Up To which is a calculated value. What is the best way to implement this so that whenever I refer to oPolicy.PaidTo it always has the latest value?
>
>I guess I need to create the property as part of the BO:
>
>
public DateTime PaidToDate = DateTime.MinValue;
>
>(is this the only way to handle null dates?)
>
>and a CalculatePaidTo method as part of the BO which returns a date time value which gets called during construction (or should it get called at some other point?)
>
>Or should I implement this as a Get/Set thing (which I have a very vague idea how to do so I'll probably be back with questions on that).
From a straight .NET POV, if the value won't change after being initially calculated then something like:
private DateTime? paidToDate;
public DateTime PaidToDate
{
get
{
if (paidToDate == null)
paidToDate= CalculatedDate();
return (DateTime) paidToDate;
}
}
DateTime CalculatedDate()
{
}
If it will change then simply call CalculatedDate() every time the get{} is accessed.