示例#1
0
 internal bool TryAddingAllExpressions(Expression rootExpression, Expression baseExpression, ICommand command, DataServiceQueryProvider.ResultSet resultSet, out Expression nodeToReplace)
 {
     if (!ExpressionHelper.IsResourceRoot(baseExpression, this.initialQueryable))
     {
         MethodCallExpression methodCallExpression = baseExpression as MethodCallExpression;
         bool flag = this.TryAddingAllExpressions(rootExpression, methodCallExpression.Arguments[0], command, resultSet, out nodeToReplace);
         if (!flag)
         {
             return(false);
         }
         else
         {
             LambdaExpression operand = (LambdaExpression)((UnaryExpression)methodCallExpression.Arguments[1]).Operand;
             operand = (LambdaExpression)PartialEvaluator.Eval(operand);
             CommandArgumentVisitor commandArgumentVisitor = new CommandArgumentVisitor(command);
             operand = commandArgumentVisitor.VisitAndConvert <LambdaExpression>(operand, "TryAddingAllExpressions");
             if (!ExpressionHelper.IsConstantTrue(operand.Body))
             {
                 return(false);
             }
             else
             {
                 nodeToReplace = methodCallExpression;
                 return(true);
             }
         }
     }
     else
     {
         nodeToReplace = baseExpression;
         return(true);
     }
 }
示例#2
0
        internal LambdaExpression InvokeFilteredGet(ICommand command, ResourceType originType, LambdaExpression filter, out DataServiceQueryProvider.ResultSet resultSet)
        {
            LambdaExpression lambdaExpression;

            using (OperationTracer operationTracer = new OperationTracer("ProcessExpression"))
            {
                LambdaExpression lambdaExpression1 = null;
                //this.schema.EntityMetadataDictionary[originType.FullName];
                resultSet = new DataServiceQueryProvider.ResultSet(originType);
                UriParametersHelper.AddParametersToCommand(command, DataServiceController.Current.GetCurrentResourceUri());
                if (filter != null)
                {
                    CommandArgumentVisitor commandArgumentVisitor = new CommandArgumentVisitor(command);
                    lambdaExpression1 = commandArgumentVisitor.VisitAndConvert <LambdaExpression>(filter, "InvokeFilteredGet");
                }
                this.InvokeCommandWithQuota(command, resultSet);
                lambdaExpression = lambdaExpression1;
            }
            return(lambdaExpression);
        }