-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Open
Description
A have a query that references values in a class. This works as expected when the query is not compiled. When the query is compiled it executes on the client. This can be seen by the lack of a where clause in the generated SQL. This works correctly in EF6.
Steps to reproduce
Run the provided code.
class MyKey
{
public string CompanyID;
}
private static void Repro(IceContext db)
{
var key = new MyKey() { CompanyID = "MyValue" };
// Not compiled it correctly evaluates on the server.
var result1 = (from row in db.SysUserComp
where row.Company == key.CompanyID
select row).FirstOrDefault();
// Compiled it evaluates on the client.
Expression<Func<IceContext, MyKey, SysUserComp>> expression =
(ctx, key_ex) =>
(from row in ctx.SysUserComp
where row.Company == key_ex.CompanyID
select row).FirstOrDefault();
var compiledQuery = EF.CompileQuery(expression);
var result2 = compiledQuery(db, key);
}Further technical details
EF Core version: 2.1.1
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.8.9
Reactions are currently unavailable