Support for query combinations involving the invocation of LambdaExpressions similar to the following:
In this case, a LambdaExpression is constructed and immediately invoked in the Where condition. This can be detected and inlined in order to produce an expression equivalent to the Where condition in the following query:
(In this example, the C# compiler adds a trivial Convert expression that converts the constructed lambda to its own type. The transformation should be able to handle this.)
This is useful for specification libraries that need to combine predicates that are given in the form of LambdaExpressions, as in the following example:
The simplification described above is added via a transformation implemented in the InvocationOfLambdaExpressionTransformer class. The transformation, which is enabled by default, replaces expressions invoking a LambdaExpression with a simplified, inlined version of the LambdaExpression's body. (It cannot inline invocations of delegate constants.)
For LINQ providers customizing the expression tree preprocessing steps applied by the re-linq front-end, add an instance of the InvocationOfLambdaExpressionTransformer class to the ExpressionTransformationStep.
Workaround until this is implemented: