How would I convert a Func<T>
into an Expression<Func<T>>
without actually composing the expression myself? I want to do this for a known T
, i.e. for a closed type.
For e.g.
class Person
{
public static Func<Person> Factory { get { return () => new Person(); } }
public static Expression<Func<Person>> ToExpression(Func<Person> personFactory)
{
// this is what I am asking
}
}