These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Question on syntax for Orderby
PostPosted: Fri May 01, 2009 1:05 pm 
Newbie

Joined: Fri May 01, 2009 12:51 pm
Posts: 3
I'm working with someone else's code, and am unfamiliar with NHibernate. I've been trying to learn the syntax and make a simple modification. I've googled and searched and have been unable to find an example that mimic's the way this is coded. It's possible the solution is simple, but I might not be searching for the right thing. At any rate, here's my method:

Code:
        public static List<CarDes> RetrieveCarsByGroupId(int CarGroupId) {
            if (CarGroupId== -1) return null;

            CarGroup cg = GenericFactory<CarGroup >.RetrieveByPrimaryKey(CarGroupId);

            List<CarDes> ret = null;
            CarDes[] l = CarDes.FindAll(
                new ICriterion[] {
                    Expression.Eq("CarGrpCd", cg)
                }
            );
            if (l.Length > 0) ret = new List<CarDes>();
            foreach (CarDes in l) {
                ret.Add(f);
            }
            return ret;
        }


I simply need to add: 'orderby carmanufact desc'

Code complete references being able to pass an Order type as the first parameter of FindAll(Order order, params ICriterion criteria), or an array of Order[] orders, but everything has failed.

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Question on syntax for Orderby
PostPosted: Mon May 04, 2009 3:28 pm 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Try Order.Asc("PropertyName") or Order.Desc("PropertyName")

_________________
--Wolfgang


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.