from c1 in ctx.Customers
from c2 in ctx.Customers
where c1.CustomerID == "ALFKI"
where c1 == c2
select c1.CustomerID
works fine (returns 1 result), however:
from c1 in ctx.Customers
from c2 in ctx.Customers
where c1.CustomerID == "ALFKI"
where c1.Equals(c2)
select c1.CustomerID
doesn't return any results, basically we perform client eval here and do reference comparison between c1 and c2. This works ok for collections (apart from the predicate being executed on the client), but returns unexpected results if we compare collections:
from c1 in ctx.Customers
from c2 in ctx.Customers
where c1.CustomerID == "ALFKI"
where c1Orders.Equals(c2.Orders)
select c1.CustomerID
The query above returns no results.
We should handle this case also, for the most part should be a matter of translating it to c1 == c2 and revisiting. Just need to detect a case when types are not matching - in case of binary expression, compiler handles that for us, but Equals method is loosely typed
works fine (returns 1 result), however:
doesn't return any results, basically we perform client eval here and do reference comparison between c1 and c2. This works ok for collections (apart from the predicate being executed on the client), but returns unexpected results if we compare collections:
The query above returns no results.
We should handle this case also, for the most part should be a matter of translating it to c1 == c2 and revisiting. Just need to detect a case when types are not matching - in case of binary expression, compiler handles that for us, but Equals method is loosely typed