Thanks Fabio, I'm currently doing something like this:
public decimal Total
{
get { return calculateTotal(); }
set { } // I really don't like this
}
Supose that calculateTotal() depends on several other properties and that
its result changes because of several other things besides the AddItem
method... I'd prefer to calculate it every time rather than clutter the
other properties setters with InvalidateTotal calls.
What do you thing about adding a "read-only" access strategy to NHibernate?
I could try to do it if it is posible.
Regards,
Germán Schuager
http://blog.schuager.com
On Tue, Dec 16, 2008 at 5:41 PM, Fabio Maulo <[email protected]> wrote:
> Sorry....
> Are you sure that you don't want it back ?public Item AddItem()
> {
> InvalidateTotal();
> ....
> return ....
> }
>
> etc. etc.
>
> 2008/12/16 Fabio Maulo <[email protected]>
>
> ;) and why you don't want it read-back ?Are you sure that you and want it
>> back ?
>>
>> public Item AddItem()
>> {
>> InvalidateTotal();
>> }
>>
>> private decimal total?;
>> public decimal Total
>> {
>> get
>> {
>> if(!total.HasValue)
>> total = CalculateTotal();
>> return total.Value;
>> }
>> }
>>
>> 2008/12/16 Germán Schuager <[email protected]>
>>
>> Hi,
>>>
>>> Is there some mapping strategy to have a calculated property persisted
>>> into the database (for querying purposes) but not read back?
>>>
>>> Something like this:
>>>
>>> public int Total
>>> {
>>> get { return calculateTotal(); }
>>> }
>>>
>>>
>>> Regards,
>>>
>>> Germán Schuager
>>> http://blog.schuager.com
>>>
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>
>
>
> --
> Fabio Maulo
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---