-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Milestone
Description
We don't currently evaluate expressions over parameters for compiled queries:
[Fact]
public void FuncletizationAndCompiledQueries()
{
using var context = CreateContext();
var name = "foo";
var results1 = context.Set<Customer>().Where(c => c.CompanyName.Length == name.Length).ToList();
// WHERE CAST(LEN([c].[CompanyName]) AS int) = @__name_Length_0"
var compiled = EF.CompileQuery(
(NorthwindContext ctx, string p)
=> ctx.Set<Customer>().Where(c => c.CompanyName.Length == name.Length));
var results2 = compiled(context, name).ToList();
// WHERE CAST(LEN([c].[CompanyName]) AS int) = CAST(LEN(@__p) AS int)")
}See also #19209 for a bit of discussion.
/cc @smitpatel @maumar
Reactions are currently unavailable