问题
Given an Expression that returns a IQueryable<sometype>
. If I don't know what sometype
is at compile-time. Can I somehow execute the Expression and get IQueryable<actual type>
returned.
Obviously I can use,
Expression.Lambda<Func<object>>(expressionInstance).Compile()()
But of course I'll get an object back. Or, I can use,
Expression.Lambda<Func<IQueryable>>(expressionInstance).Compile()()
But I'll get back a IQueryable
which is of no use if I want to actually use any extension methods such as select, etc., I'll still need IQueryable<actual type>
.
来源:https://stackoverflow.com/questions/55056318/is-there-anyway-to-execute-this-expression-and-get-the-actual-value-not-as-objec