예제 #1
0
        protected override Expression VisitMember(MemberExpression node)
        {
            if (ApplicableOrderByMethods.Contains(this.method))
            {
                var memeber = node.Member;

                if (memeber.Name == "Id" && typeof(NuGetPackageInfo).IsAssignableFrom(memeber.ReflectedType))
                {
                    idOrderRule = method == "OrderBy"
                        ? IdOrderRule.Asc
                        : IdOrderRule.Desc;
                }
            }

            return(base.VisitMember(node));
        }
예제 #2
0
        protected override Expression VisitMethodCall(MethodCallExpression node)
        {
            this.method = node.Method.Name;

            var args    = node.Arguments;
            var orderBy = args.Last();

            this.Visit(orderBy);

            //if visited member and not find - return original
            if (idOrderRule != IdOrderRule.None)
            {
                this.nuGetQueryFilter.OrderById = this.idOrderRule;
                idOrderRule = IdOrderRule.None;
            }
            else
            {
                this.NotEvaluated(node);
            }

            return(args.First());
        }