Example #1
0
        public Expression GetResolvedOptionalElementSelector(ClauseGenerationContext clauseGenerationContext)
        {
            if (OptionalElementSelector == null)
            {
                return(null);
            }

            return
                (_cachedElementSelector.GetOrCreate(
                     r => r.GetResolvedExpression(OptionalElementSelector.Body, OptionalElementSelector.Parameters[0], clauseGenerationContext)));
        }
        public Expression GetResolvedResultSelector(ClauseGenerationContext clauseGenerationContext)
        {
            // our result selector usually looks like this: (i, j) => new { i = i, j = j }
            // with the data for i coming from the previous node and j identifying the data from this node

            // we resolve the selector by first substituting j by a QuerySourceReferenceExpression pointing back to us, before asking the previous node
            // to resolve i

            return(_cachedResultSelector.GetOrCreate(
                       r => r.GetResolvedExpression(
                           QuerySourceExpressionNodeUtility.ReplaceParameterWithReference(this, ResultSelector.Parameters[1], ResultSelector.Body, clauseGenerationContext),
                           ResultSelector.Parameters[0],
                           clauseGenerationContext)));
        }
 public LambdaExpression GetResolvedFunc(ClauseGenerationContext clauseGenerationContext)
 {
     // '(total, current) => total + current' becomes 'total => total + [current]'
     return(_cachedFunc.GetOrCreate(
                r => Expression.Lambda(r.GetResolvedExpression(Func.Body, Func.Parameters[1], clauseGenerationContext), Func.Parameters[0])));
 }
Example #4
0
 public Expression GetResolvedPredicate(ClauseGenerationContext clauseGenerationContext)
 {
     return(_cachedPredicate.GetOrCreate(r => r.GetResolvedExpression(Predicate.Body, Predicate.Parameters[0], clauseGenerationContext)));
 }
Example #5
0
 public Expression GetResolvedKeySelector(ClauseGenerationContext clauseGenerationContext)
 {
     return(_cachedKeySelector.GetOrCreate(r => r.GetResolvedExpression(KeySelector.Body, KeySelector.Parameters[0], clauseGenerationContext)));
 }
 public Expression GetResolvedResultSelector(ClauseGenerationContext clauseGenerationContext)
 {
     return(_cachedResultSelector.GetOrCreate(r => r.GetResolvedExpression(
                                                  QuerySourceExpressionNodeUtility.ReplaceParameterWithReference(this, ResultSelector.Parameters[1], ResultSelector.Body, clauseGenerationContext),
                                                  ResultSelector.Parameters[0], clauseGenerationContext)));
 }