Hi, thank you for clarification. But there should be some hint how to use it. For instance in the method summary or something.
regards Kamil Kliczbor On 12 Sty, 17:40, "Richard Brown \(gmail\)" <[email protected]> wrote: > Hi Kamil, > > Sorry for the delay ... I started to fix this then I realised the current > functionality is OK (if a little confusingly named). > > To order by an alias simply use it directly (the OrderByAlias() method is > purely for aliased projections, and not required for regular aliases). So > all you need is: > > this.Session.QueryOver<Product>() > .JoinAlias(x => x.Category, () => categoryAlias) > .OrderBy(x => x.Name).Desc > .ThenBy(() => categoryAlias.Name).Asc > .List<Product>(); > > Sorry for the confusion. > > Richard-----Original Message----- > From: kamil.kliczbor > Sent: Thursday, January 06, 2011 8:42 PM > To: nhusers > Subject: [nhusers] Re: QueryOver OrderByAlias doesn't sort as expected > > Thx Richard, > here is:http://216.121.112.228/browse/NH-2493 > > On 6 Sty, 12:18, "Richard Brown \(gmail\)" <[email protected]> > wrote: > > Hi Kamil, > > > That looks like a bug to me ... could you raise a JIRA? > > > Cheers, > > Richard > > > -----Original Message----- > > From: kamil.kliczbor > > Sent: Wednesday, January 05, 2011 10:51 PM > > To: nhusers > > Subject: [nhusers] QueryOver OrderByAlias doesn't sort as expected > > > Hello everyone, > > > I cannot use the OrderByAlias / ThenByAlias method in QueryOver query. > > When I use > > this.Session.QueryOver<Product>() > > .OrderBy(x => x.Name).Desc > > .JoinQueryOver(x => x.Category, () => categoryAlias) > > .OrderBy(x => x.Name).Asc > > .List<Product>(); > > > It produces the right SQL: > > SELECT this_.ProductId as ProductId6_1_, > > this_.ProductName as ProductN2_6_1_, > > ... > > categoryal1_.Description as Descript3_5_0_ > > ... > > FROM Products this_ > > inner join Categories categoryal1_ > > on this_.CategoryId = categoryal1_.CategoryId > > ORDER BY this_.ProductName desc, > > categoryal1_.CategoryName asc > > > But when I try to write this query in other way - like this: > > this.Session.QueryOver<Product>() > > .JoinAlias(x => x.Category, () => categoryAlias) > > .OrderBy(x => x.Name).Desc > > .ThenByAlias(() => categoryAlias.Name).Asc > > //.OrderByAlias(() => categoryAlias.Name).Asc > > .List<Product>(); > > > it produces wrong SQL (insted of category name it orders ascending by > > product name ): > > SELECT ... FROM Products this_ inner join Categories categoryal1_ on > > this_.CategoryId=categoryal1_.CategoryId ORDER BY this_.ProductName > > desc, this_.ProductName asc > > > Did I missed something ? > > > -- > > 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 > > athttp://groups.google.com/group/nhusers?hl=en. > > -- > 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 > athttp://groups.google.com/group/nhusers?hl=en. -- 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.
