Is there a function similar to Math.Max for Entity Framework?
- by Ryan ONeill
I have an entity framework query as follows;
From T In Db.MyTable
Where (T.Col1 - T.Col2) + T.Col3 - T.Col4 > 0 _
Select T
I now need to make sure that the bracketed part '(T.Col1 - T.Col2)' does not go below zero.
In .Net, I'd code it as follows (but obviously EF does not like Math.Max).
From T In Db.MyTable
Where Math.Max(T.Col1 - T.Col2,0) + T.Col3 - T.Col4 > 0 _
Select T
Is there an easy way to do this? I am using EF 2.0 (not the latest, just released version).
Thanks in advance