Hello,
I've a strange problem with a linq query.
When I execute the following linq queries, I got different results.
Dim queryOk = From h In metaData.THisAedPac Where h.THisAedPac_Mont.Value < 100
Dim openWrong = From h In metaData.THisAedPac Where 100 > h.THisAedPac_Mont.Value
The difference between the two queries is the position of the compare value (in this case "100").
Here the produced SQL-Query:
SELECT TOP(@p2) COUNT(*) AS [LPAV_] FROM [Test].[dbo].[THisAedPac] [LPLA_1] WHERE ( ( ( ( [LPLA_1].[THisAedPac_Mont] < @p3))))
SELECT TOP(@p2) COUNT(*) AS [LPAV_] FROM [Test].[dbo].[THisAedPac] [LPLA_1] WHERE ( ( ( ( [LPLA_1].[THisAedPac_Mont] <= @p3))))
As you see, not only the position of my constant but also the meaning of operand is swapped.
">" is converted to "<=" which is wrong!
When I execute the same queries with "Field > 100" or "100 < Field" the produced SQL-Queries are the correct. The position of the constant is swapped and "<" is converted to ">".
For me, this is a problme in the DetermineComparisonOperatorForPredicate-Function of the LinqUtils-Class. In this function the operand GreaterThan is swapped to LessEqual.
Must GreaterThan not be swapped to LessThan?
I'm using LLBLGen 3.1 (release date April 14th, 2011) with VB.Net 2010.
Any help is appreciated!
With best regards,
Ingbert