internal static Expression ComposePropertyNavigation(Expression expression, LambdaExpression filterLambda, bool propagateNull, bool isSingleResult) { Expression nullLiteral = ExpressionUtils.NullLiteral; if (isSingleResult) { Expression right = ParameterReplacerVisitor.Replace(filterLambda.Body, filterLambda.Parameters[0], expression); Expression test = propagateNull ? Expression.AndAlso(Expression.NotEqual(expression, nullLiteral), right) : right; Expression ifTrue = expression; Expression ifFalse = Expression.Constant(null, ifTrue.Type); return(Expression.Condition(test, ifTrue, ifFalse)); } Type targetType = filterLambda.Parameters[0].Type; Expression expression7 = expression.EnumerableWhere(filterLambda); if (propagateNull) { Expression expression8 = Expression.Equal(expression, nullLiteral); Expression expression9 = expression7; Expression expression10 = ExpressionUtils.EnumerableEmpty(targetType); return(Expression.Condition(expression8, expression10, expression9, expression10.Type)); } return(expression7); }