You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Query: Consider adding method to force client evaluation of an expression #12736
The fix for #12697 enables using a method defined like this in a query:
publicstaticTClient<T>(Ts)=>s;
The point being that the method is opaque to our query translator and therefore forces client evaluation. I want to suggest that we consider adding a method like that somewhere under the static EF class for better discoverability.
I haven't tested how well it works and I am not sure I understand all the implications but ideally this could be used both on the way in (to force funcletization of an expression that would otherwise be translated, i.e. a shortcut for having to write the expression outside the query) and on the way out (force client evaluation of an expression that would otherwise be translated).
Example usage:
vardata=(fromcindb.Checks
join ctindb.CheckTemplates.Include(a =>a.Implementers).ThenInclude(u =>u.User)
on c.CheckTemplateId equals ct.CheckTemplateIdwherec.CheckId==checkIdselectnew{CheckId=c.CheckId,Description=ct.Description,Implementers=EF.Client(ct).Implementers,NumExaminers=ct.Examiners.Count};
Activity
pmiddleton commentedon Jul 20, 2018
Could users misunderstand the feature and try passing a lambda to the Client method that references column data? That won't be executable client side.
divega commentedon Jul 20, 2018
@pmiddleton that is a reason to come up with a good name. Worst case that would cause N+1 queries (or throw).
ajcvickers commentedon Jul 30, 2018
Tracking this as part of 3.0 query behaviors, so added to #12795