Must have missed this response :o) Don't see why it's that a weird thing to want to do. After all the criteria api seems to support projection in 1001 different ways. Why not some arithmetic? I didn't want to fetch full entities back (the rasion d'etry of the projection api??), and needed to do a quick calculation which happens to be meaningless in my domain but is based on properties that do exist on the domain.
Graeme On Sep 17, 7:31 am, Fabio Maulo <[email protected]> wrote: > In a select ? > The RDBMS exists only for an accident of IT and technology in general. > You can do it in the class instead delegate it to the RDBMS... poor RDBMS.. > it is so busy with a lot of other stuff and it is alone in its server in > that cold room... > > > > > > > > > > On Wed, Sep 15, 2010 at 6:40 AM, grae123 <[email protected]> wrote: > > Hi, > > > I'm trying to run a query which will select 'propertya - propertyb' > > and must be having a bad day as I can't get it to work (NH3.0 alpha 3, > > QueryOver API) > > > So-far I've tried: > > > Doing a .Select(o => o.propertya - o.propertyb) but queryover expects > > the expression to be a property. > > Mapping a formula on my entity to the expression. Problem is propertyb > > is on a base-class and I can't get the formula to take that into > > account when producing sql. > > Doing a .SqlProjection which gets closer but the code is pretty gross > > and I couldn't help but think there must be an easier way. > > > Has anyone done this using the Criteria API, and if-so how did you do > > it? Apologies if it's really simple (and it feels like it should be), > > but I've googled a fair bit and have not come up with any examples. > > > Thanks, > > > Graeme > > > -- > > 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]<nhusers%[email protected] > > > > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > 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.
