when I execute these operators( > and >=) lambda expression in entity framework. both are getting same results.
db.Companies.where(Company => (Compare(Convert(Company.Name), "y") > 0))db.Companies.where(Company => (Compare(Convert(Company.Name), "y") >= 0))
Is that issue with Lambda expression compare operator?
i changed to
-
db.Companies.where(Company => (Compare(Convert(Company.Name), "y") > 1))– No results. Its not correct -
db.Companies.where(Company => (Compare(Convert(Company.Name), "y") >= 1))– 64 results
source code
case operatorType.Greater: return Expression.GreaterThan(Expression.Call(typeof(string),
"Compare", null, new[] { argLeft, argRight }),
Expression.Constant(1, typeof(int)));
case operatorType.GreaterEqual: return Expression.GreaterThanOrEqual( Expression.Call(typeof(string), "Compare", null, new[] { argLeft, argRight }),
Expression.Constant(1, typeof(int)));
Thanks for all responses The Lambda expression query is correct only.
I changed the “right arg” value to “Test”. I have one record ‘Name’ with Test. executed the following query.
and shown the results 105(here Name with ‘Test’ is not shown. – Correct
Then I executed this
and shown the results 106(here Name with ‘Test’ is shown) – Correct