Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Need to add Where to this LINQ expression

return base.QueryOver(query).
                    WhereRestrictionOn(x => x.DealerId).
                    OrderBy(x => x.SortOrder).Asc;


I need to add Where(x  => x.Status == true)

but do not know how to ad this correctly since there is already a call to WhereRestrictionOn
SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

I tried these all prior to posting, but none works
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It actually checks against an enumerate values, but the syntax is failing so I just used a book in this quersion.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So sorry, YES this is NHibernate.
Also if your original query is actually working then did you try putting the Where before WhereRestrictionOn as shown below?

return base.QueryOver(query).
            Where(x  => x.Status == true).
            WhereRestrictionOn(x => x.DealerId).
            OrderBy(x => x.SortOrder).Asc;

Open in new window

AndRestrictionOn() solves the problem
thanks