curiouswebster
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It actually checks against an enumerate values, but the syntax is failing so I just used a book in this quersion.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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;
ASKER
AndRestrictionOn() solves the problem
ASKER
thanks
ASKER