I have two expression trees defined as follows:
private Expression<Func<TEntity, TPropertyResult>> PropertyAccessor { get; set; }
and
private Expression<Func<TPropertyResult, bool>> TestExpression { get; set; }
I need to create a new expression tree that will lead to the equivalent:
var expression = p => this.TestExpression(this.PropertyAccessor(p));
When using Expression.Invoke(this.TestExpression, this.PropertyAccessor) I get the following error
{"An expression of type 'System.Func`2 [MyEntity, System.String] cannot be used for a parameter of type' System.String '"}
TPropertyResult is a string during my test.
I tried using Expression.Call or Expression.Invoke . Bad luck. What should i use?
c # lambda expression-trees
Pierre-alain vigeant
source share