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
The DbFunctions that do not have any references to DbContext are now always executing on the client for some reason. No attempt is made to translate them with IMethodCallTranslator.
then no translation is performed and EF tries to execute it locally, resulting in exception. Niladic functions meant to execute on the server also do not work (since they don't have any references to DbContext).
This worked correctly in 2.2, but it's not working in 3.1. Is this a bug in EF or do I need to do something on my end to make it work again?
I do not see this mentioned in 3.0 breaking changes as it does not appear to be related to #12757. I also don't think it's related to #9022.
Further technical details
EF Core version: 3.1.4
Database provider: the one I'm writing
The text was updated successfully, but these errors were encountered:
EF.Functions.Degrees(2) is not correlated with server in anyway and it will always be evaluated on client and converted to parameter. That is how parameter extraction works on a query to aid query caching. See #13524 & #13549
If you want the function to evaluate on client side then you can body for the method.
I suggest reading this thread, it capture everything. #12527
You can register your function to be not evaluatable on client side by using IExpressionEvaluatbleFilter service.
In our providers, we don't do it. If EF.Functions.Degrees(2) is not server correlated then there is very little value in sending it to server rather than using direct value.
I'm sorry, I introduced a bug while upgrading our IEvaluatableExpressionFilter implementation to 3.x and forgot that it was involved in this. Thanks very much!
EF.Functions.Degrees was just a bad example, since there is such a function in most providers for converting radians to degrees. I was just talking about any function that must be evaluated on the server.
The DbFunctions that do not have any references to DbContext are now always executing on the client for some reason. No attempt is made to translate them with
IMethodCallTranslator
.Steps to reproduce
Consider the following
DbFunctions
extension:If the application does the following:
then
EF.Functions.Degrees
is translated by myIMethodCallTranslator
into the desired server-side function call. But if the application does this:then no translation is performed and EF tries to execute it locally, resulting in exception. Niladic functions meant to execute on the server also do not work (since they don't have any references to DbContext).
This worked correctly in 2.2, but it's not working in 3.1. Is this a bug in EF or do I need to do something on my end to make it work again?
I do not see this mentioned in 3.0 breaking changes as it does not appear to be related to #12757. I also don't think it's related to #9022.
Further technical details
EF Core version: 3.1.4
Database provider: the one I'm writing
The text was updated successfully, but these errors were encountered: