Inside another expression, evaluate a C# expression.

c# expression-trees linq-to-sql

Question

I'd want to use this phrase in another one:

Expression<Func<double, double>> f = x => x * x * 27 + blah ... expression with x;

Expression<Func<double, double>> g = y => 3 + 8 * f.Compile()(y) * y * blah... expression with y and f(y);

Due to the fact that f.Compile() is not known to SQL, this will not function when passed to LINQ to SQL.

How do you assess the statement?f about the variabley defining it using standard syntax without compiling itg ?

I don't want to have to explain anything.g a few illegibleExpression.Add /Expression.Multiply etc. assertions

Thanks.

1
11
8/8/2011 4:52:57 AM

Accepted Answer

Look at the projects LINQ queries that call functions and Extensions to LINQ. Although the CLinq component is unrelated to your query, it also contains the LinqExt library, which is exactly what you need. The similar strategy is also used by LinqKit, which offers more helpful extensions for Linq.

3
8/8/2011 5:56:49 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow