There is a known issue in the Entity Framework that the certain scenarios might lead to the presence of CROSS APPLY and/or OUTER APPLY operators in the output query.
These scenarios are:
• A correlated subquery with paging.
• An "AnyElement" over a correlated sub-query, or over a collection produced by navigation.
• LINQ queries that use grouping methods that accept an element selector.
• A query in which a CROSS APPLY or an OUTER APPLY is explicitly specified
• A query that has a DEREF construct over a REF construct.
As far as I am aware, the only databases that support these APPLY operators are SQL Server 2005 and later.
This issue has been around since at least
Since this issue has not been fixed for over 3 years, I would estimate that there is a low chance of it being fixed within the EF in the next few months.
Therefore what recommendations are there for getting around this problem? They fall in two categories:
1. Change/Upgrade the backend database to support the APPLY operators, or
2. Rewrite the LINQ
Option #1 is not viable at this stage.
Option #2 can be done when you are writing LINQ, but when exposing an OData DataService to external clients it is not as easily.
What can we include in our OData DataService usage guide so that clients of our DataService know what patterns of queries they can and cannot use?
"Try the DataService with the URL parameters you require, and if you get a message like "Oracle 11.1 does not support APPLY" then reformat the URL query" is not specific enough nor professional.
Additionally, is there any configuration within our Data Service code that we can insert that would minimize this issue?
FYI This issue is mentioned at: