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
Provide a way to control client evaluation behavior on a per query basis #12844
Based on the feedback we usually see this is very common and something like an AsServerOnly() query operator would be more usabel than the current way to turning client evaluation warnings into errors.
An extension method on IQueryable for this would be great.
My main use case is where .ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)) has been configured on the context, but where I still want to allow some client evaluation to occur (most likely because there is no server-side support).
i.e. I don't want an error thrown if there's nothing I can do to fix it.
changed the title [-]Provide a way to control client evaluation behavior on a query basis[/-][+]Provide a way to control client evaluation behavior on a per query basis[/+]on Jul 31, 2018
@smitpatel, AsEnumerable() isn't discoverable enough nor explicit enough IMO. I don't see how AsEnumerable() implies that client-evaluation is acceptable?
AsEnumerable is similar to calling ToList. You are asking EF to materialize query results upto that point, whatever happens afterwards is outside of EF scope (aka client eval). If client eval in EF is throwing exception then it would also tell you what failed to translate which gives easy pointer where to put AsEnumerable in your query.
Please also consider whether it would make sense to provide a predicate on Throws, i.e. something like warnings.Throw(RelationalEventId.QueryClientEvaluationWarning, query => /* some logic* / true). I'm not sure what the appropriate type for query would be.
I think this would let us then implement this behaviour ourselves if necessary, especially if the Expression was provided.
Activity
optiks commentedon Jul 31, 2018
An extension method on IQueryable for this would be great.
My main use case is where
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning))has been configured on the context, but where I still want to allow some client evaluation to occur (most likely because there is no server-side support).i.e. I don't want an error thrown if there's nothing I can do to fix it.
[-]Provide a way to control client evaluation behavior on a query basis[/-][+]Provide a way to control client evaluation behavior on a per query basis[/+]smitpatel commentedon Jul 31, 2018
@optiks - Calling
AsEnumerablemethod onIQueryablewill allow you to do client evaluation even when warnings are configured to throw.ajcvickers commentedon Aug 1, 2018
Added to Qu3ry issue.
optiks commentedon Aug 1, 2018
@smitpatel,
AsEnumerable()isn't discoverable enough nor explicit enough IMO. I don't see howAsEnumerable()implies that client-evaluation is acceptable?smitpatel commentedon Aug 2, 2018
AsEnumerableis similar to callingToList. You are asking EF to materialize query results upto that point, whatever happens afterwards is outside of EF scope (aka client eval). If client eval in EF is throwing exception then it would also tell you what failed to translate which gives easy pointer where to putAsEnumerablein your query.optiks commentedon Aug 31, 2018
Please also consider whether it would make sense to provide a predicate on
Throws, i.e. something likewarnings.Throw(RelationalEventId.QueryClientEvaluationWarning, query => /* some logic* / true). I'm not sure what the appropriate type forquerywould be.I think this would let us then implement this behaviour ourselves if necessary, especially if the
Expressionwas provided.ajcvickers commentedon Jan 24, 2019
Closing as not needed now since the query changes for 3.0.