This project is read-only.

Query Cache False Positives With nested query constants


The query cache does not properly compare query expressions which were written in a way that involves queries to be composed as constant expressions.
for example:
var inner = db.Customers.Where(c=>c.CustomerID == "ALFKI")
var outer = from o in db.Orders
             from c in inner
             select new { c, o }; // outer is query composing inner
The expression of outer will represent an outer.SelectMany(c=>CONSTANT EXPRESSION(inner)).
Query cache does not inspect the constant and just returns true, therefore:
var inner2 = db.Customers.Skip(3).Take(4);
var outer2 = from o in db.Orders
               from c in inner2
               select new { c, o };
outer1 and outer2 would be considered equal (despite the fact they produce very different results)