I have below method which gives a Expression<Func<T, Result<T>>> type.
public Expression<Func<T, Result<T>>> GetExpression<T>()
{
//Do something to retrun expression
}
public class Result<T>
{
public bool IsSuccess { get; set; }
public string Message { get; set; }
public Result<T> ChildResult { get; set; }
}
Now I have another method as shown below where I want to access to return result from GetExpression method.
public void UseExpression<T>()
{
var expression = GetExpression<T>();
//I want to get the expression for return Result<T> from above method call and get access to it's properties like IsSuccess which can itself be a binary expression
}
I want to get the expression for return Result from above method call and get access to it's properties like IsSuccess which can itself be a binary expression. All this without compiling the expression.
End goal: Let's think of it as a method call, method M1 returns Result R1 and method M2 uses this result R1 which(M2) has to create its own result R2 but method M2 has to do an Epxression.Or() on the IsSuccess property of R1 with some other bool expression to create R2 so we need the express. So we need to just get the IsSuccess property from R1 in M2 and then use it.
Please suggest how can I achieve it?
Thanks in advance.