protected override Expression VisitMethodCall(MethodCallExpression node) { if (node.Method.Name == "Select" &&//both expansion.MemberType and node.Type will be lists expansion.MemberType.GetUnderlyingElementType() == node.Type.GetUnderlyingElementType() && this.expression.ToString().StartsWith(node.ToString())) //makes sure we're not updating some nested "Select" { return(node.GetOrderBy(node.GetUnderlyingElementType(), expansion.QueryOption.SortCollection)); } return(base.VisitMethodCall(node)); }
protected override Expression VisitMethodCall(MethodCallExpression node) { if (node.Method.Name == "Select" && expansion.MemberType.GetUnderlyingElementType() == node.GetUnderlyingElementType() && this.expression.ToString().StartsWith(node.ToString())) //makes sure we're not updating some nested "Select" { return(node.GetWhereCall(expansion.FilterOption.FilterLambdaOperator.Build())); } return(base.VisitMethodCall(node)); }
protected override Expression VisitMethodCall(MethodCallExpression node) { if (node.Method.Name == "Select" && expansion.MemberType.GetUnderlyingElementType() == node.GetUnderlyingElementType() && this.expression.ToString().StartsWith(node.ToString())) //makes sure we're not updating some nested "Select" { FilterLambdaOperator filterOperator = mapper.Map <FilterLambdaOperator> ( expansion.FilterOption.Filter, opts => opts.Items[ExpressionOperators.PARAMETERS_KEY] = new Dictionary <string, ParameterExpression>() ); return(node.GetWhereCall(filterOperator.Build())); } return(base.VisitMethodCall(node)); }
protected override Expression VisitMethodCall(MethodCallExpression node) { Type elementType = expansion.MemberType.GetUnderlyingElementType(); if (node.Method.Name == "Select" && elementType == node.Type.GetUnderlyingElementType() && this.expression.ToString().StartsWith(node.ToString())) //makes sure we're not updating some nested "Select" { return(Expression.Call ( node.Method.DeclaringType, "Where", new Type[] { node.GetUnderlyingElementType() }, node, expansion.FilterOptions.FilterClause.GetFilterExpression(elementType) )); } return(base.VisitMethodCall(node)); }