In many places in the query pipeline, we extract the ShapedQueryExpression.ShaperExpression (unwrapping casts), and then extract the projection from the corresponding QueryExpression; see RelationalQueryableMethodTranslatingExpressionVisitor.TryGetProjection for an example. We should DRY this, possibly adding APIs (or extensions) to ShapedQueryExpression.
In many places in the query pipeline, we extract the ShapedQueryExpression.ShaperExpression (unwrapping casts), and then extract the projection from the corresponding QueryExpression; see RelationalQueryableMethodTranslatingExpressionVisitor.TryGetProjection for an example. We should DRY this, possibly adding APIs (or extensions) to ShapedQueryExpression.