public ProcessingResult ProcessQuery(MethodCallExpression query, ProcessingResult parentResult, DataContext context)
        {
            if (!parentResult.IsDeferred())
            {
                return(ProcessingResult.Unsuccessful);
            }

            var predicate       = query.Arguments[1];
            var predicateResult = ExpressionProcessingHelper.ProcessPredicate(predicate, parentResult.GetDeferredItems(), context);

            if (!predicateResult.IsSuccess)
            {
                return(ProcessingResult.Unsuccessful);
            }

            var parentResultCount    = parentResult.GetDeferredItems().Count();
            var predicateResultCount = predicateResult.GetDeferredItems().Count();

            var result = (parentResultCount == predicateResultCount);

            return(new ProcessingResult(true, result, true));
        }
        public ProcessingResult ProcessQuery(MethodCallExpression query, ProcessingResult parentResult, DataContext context)
        {
            if (!parentResult.IsDeferred())
            {
                return(ProcessingResult.Unsuccessful);
            }

            var predicateResult = ExpressionProcessingHelper.ProcessPredicate(query.Arguments[1], parentResult.GetDeferredItems(), context);

            return(predicateResult.IsSuccess ? predicateResult : ProcessingResult.Unsuccessful);
        }
Ejemplo n.º 3
0
        public ProcessingResult ProcessQuery(MethodCallExpression query, ProcessingResult parentResult, DataContext context)
        {
            var hasPredicate = query.Arguments.Count == 2;

            if (!hasPredicate)
            {
                return(ProcessQuery(parentResult.GetItems().GetEnumerator(), QueryProcessingHelper.GetReturnParameterType(query)));
            }

            if (!parentResult.IsDeferred())
            {
                return(ProcessingResult.Unsuccessful);
            }

            var predicate       = query.Arguments[1];
            var predicateResult = ExpressionProcessingHelper.ProcessPredicate(predicate, parentResult.GetDeferredItems(), context);

            return(predicateResult.IsSuccess
                ? ProcessQuery(predicateResult.GetItems().GetEnumerator(), QueryProcessingHelper.GetReturnParameterType(query))
                : ProcessingResult.Unsuccessful);
        }