示例#1
0
        void HandleMethodCall(OrderSpecificationMethod method, MethodCallExpression node)
        {
            var arguments = node.Arguments.ToList();

            if (arguments.Count != 2)
            {
                return;
            }

            var selector = (arguments[1] as UnaryExpression)?.Operand as LambdaExpression;

            if (selector == null)
            {
                return;
            }

            if (selector.Parameters.Count != 1)
            {
                return;
            }

            var property = selector.TryGetAccesedProperty().ValueOrDefault();

            if (property == null)
            {
                return;
            }

            var methodName = node.Method.Name;
            var type       = selector.Parameters[0].Type;


            orders.Add(new MemberItemOrder(property, method.Direction));

            if (method.IsPrimary)
            {
                orders
                    = mapi(orders.Reverse <MemberItemOrder>(), (i, e) => e.Clone(NewPrecedence: i)).ToList();
            }
        }