You can map a calculated field from the DB which uses this query... Gustavo.
On Tue, Jan 6, 2009 at 10:53 AM, Hielke Hoeve <[email protected]>wrote: > > 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 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
