Convert Sql Where clause to IPredicate

Posts   
 
    
dpanet
User
Posts: 14
Joined: 31-Oct-2006
# Posted on: 31-Oct-2006 09:16:19   

How can I convert this clause to IPredicate statement

SELECT * FROM OrdersDetail Where (Quantity * 3) < 12

I tried this but I get an error

filter.Add((OrderDetailsFields.Quantity *3 ) < 12));

because 12 is not type of Expression

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 31-Oct-2006 17:41:17   

Hi,

indeed you don't have an operator overload corresponding to:

expression < object -> predicate instead, you can use entityproperty < object -> predicate with an expression assigned to the entityproperty so basically, create a new Quantity EntityField and assign the ExpressionToApply property to OrderDetailsFields.Quantity *3, and it should work.

Cheers