Consider two expression trees:
Expression<Func<float, float, float>> f1 = (x, y) => x + y;
Expression<Func<float, float>> f2 = x => x * x;
I want to substitute the expression f2 as a second parameter of f1 and obtain the following expression:
Expression<Func<float, float, float>> f3 = (x, y) => x + y * y;
The simplest way is to use Expression.Lambda and Expression.Invoke, but the result will look like
(x, y) => f1(x, f2(y))
But this is unacceptable for me due to ORM limitations that cannot handle invoke/lambda properly.
Is it possible to construct the expression without full traversal of expression trees? A working example that fulfill my needs can be found here but I want simpler solution.