Why are some object properties UnaryExpression and others MemberExpression?

I think I know what the problem is. Your expression returns type object.

If you change this to Expression<Func<T, R>> the return type should be correctly inferred, and UnaryExpression (which I will assume is some boxing operation) should not occur.

Update:

The signature for Include should be:

public void Include<T, R>(Expression<Func<T, R>> expression)

Leave a Comment