I don't know which is exactly your case... I hope that you know when use C#
for what C# was done, and SQL for what SQL was done.The use of <formula> tag
feature was implemented for some special case, when is impossible calculate
something in the business-side and for some trick but not to use SQL
everywhere.

Remember that NHibernate is a persistence-layer and nothing more than a very
good persistence layer; don't delegate business responsibility to NH, take
care with this.


2009/1/6 Hielke Hoeve <[email protected]>

>
> I tried searching the groups and old forums but haven't found a
> similar question. Maybe i used the wrong keywords but alas...
>
> I am using the NHContrib project NHibernate.Mapping.Attributes and am
> wondering if it is possible to make a property that is not saved in
> the database as a column but gets its value from a custom query.
>
> Example, instead of saving the cars mileage:
>
> class Car
> {
>   [Property]
>   public virtual int Mileage {get;set;}
> }
>
> Example, get the mileage from each time we fill up the tank:
>
> class Car
> {
>   [Property(SELECT="SELECT AVG(drivenkilometers/liters) FROM
> PAYMENTS")]
>   public virtual int Mileage {get;}
> }
>
> Obviously the query is not what we want but this is just an example ;)
>
> Hielke
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to