public AggregateFromSeedExpressionNode( MethodCallExpressionParseInfo parseInfo, Expression seed, LambdaExpression func, LambdaExpression optionalResultSelector) : base(parseInfo, null, null) { ArgumentUtility.CheckNotNull("seed", seed); ArgumentUtility.CheckNotNull("func", func); if (func.Parameters.Count != 2) { throw new ArgumentException("Func must have exactly two parameters.", "func"); } if (optionalResultSelector != null && optionalResultSelector.Parameters.Count != 1) { throw new ArgumentException("Result selector must have exactly one parameter.", "optionalResultSelector"); } Seed = seed; Func = func; OptionalResultSelector = optionalResultSelector; _cachedFunc = new ResolvedExpressionCache <LambdaExpression> (this); }
public JoinExpressionNode( MethodCallExpressionParseInfo parseInfo, Expression innerSequence, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector, LambdaExpression resultSelector) : base(parseInfo) { ArgumentUtility.CheckNotNull("innerSequence", innerSequence); ArgumentUtility.CheckNotNull("outerKeySelector", outerKeySelector); ArgumentUtility.CheckNotNull("innerKeySelector", innerKeySelector); ArgumentUtility.CheckNotNull("resultSelector", resultSelector); if (outerKeySelector.Parameters.Count != 1) { throw new ArgumentException("Outer key selector must have exactly one parameter.", "outerKeySelector"); } if (innerKeySelector.Parameters.Count != 1) { throw new ArgumentException("Inner key selector must have exactly one parameter.", "innerKeySelector"); } if (resultSelector.Parameters.Count != 2) { throw new ArgumentException("Result selector must have exactly two parameters.", "resultSelector"); } InnerSequence = innerSequence; OuterKeySelector = outerKeySelector; InnerKeySelector = innerKeySelector; ResultSelector = resultSelector; _cachedOuterKeySelector = new ResolvedExpressionCache <Expression> (this); _cachedInnerKeySelector = new ResolvedExpressionCache <Expression> (this); _cachedResultSelector = new ResolvedExpressionCache <Expression> (this); }
public GroupByExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression keySelector, LambdaExpression optionalElementSelector) : base(parseInfo, null, null) { ArgumentUtility.CheckNotNull("keySelector", keySelector); if (keySelector.Parameters.Count != 1) { throw new ArgumentException("KeySelector must have exactly one parameter.", "keySelector"); } if (optionalElementSelector != null && optionalElementSelector.Parameters.Count != 1) { throw new ArgumentException("ElementSelector must have exactly one parameter.", "optionalElementSelector"); } KeySelector = keySelector; OptionalElementSelector = optionalElementSelector; _cachedKeySelector = new ResolvedExpressionCache <Expression> (this); if (optionalElementSelector != null) { _cachedElementSelector = new ResolvedExpressionCache <Expression> (this); } }
public SelectManyExpressionNode( MethodCallExpressionParseInfo parseInfo, LambdaExpression collectionSelector, LambdaExpression resultSelector) : base(parseInfo) { ArgumentUtility.CheckNotNull("collectionSelector", collectionSelector); if (collectionSelector.Parameters.Count != 1) { throw new ArgumentException("Collection selector must have exactly one parameter.", "collectionSelector"); } CollectionSelector = collectionSelector; if (resultSelector != null) { if (resultSelector.Parameters.Count != 2) { throw new ArgumentException("Result selector must have exactly two parameters.", "resultSelector"); } ResultSelector = resultSelector; } else { var parameter1 = Expression.Parameter(collectionSelector.Parameters[0].Type, collectionSelector.Parameters[0].Name); var itemType = ReflectionUtility.GetItemTypeOfClosedGenericIEnumerable(CollectionSelector.Body.Type, "collectionSelector"); var parameter2 = Expression.Parameter(itemType, parseInfo.AssociatedIdentifier); ResultSelector = Expression.Lambda(parameter2, parameter1, parameter2); } _cachedCollectionSelector = new ResolvedExpressionCache <Expression> (this); _cachedResultSelector = new ResolvedExpressionCache <Expression> (this); }
public GroupJoinExpressionNode( MethodCallExpressionParseInfo parseInfo, Expression innerSequence, LambdaExpression outerKeySelector, LambdaExpression innerKeySelector, LambdaExpression resultSelector) : base(parseInfo) { ArgumentUtility.CheckNotNull("innerSequence", innerSequence); ArgumentUtility.CheckNotNull("outerKeySelector", outerKeySelector); ArgumentUtility.CheckNotNull("innerKeySelector", innerKeySelector); ArgumentUtility.CheckNotNull("resultSelector", resultSelector); if (outerKeySelector.Parameters.Count != 1) { throw new ArgumentException("Outer key selector must have exactly one parameter.", "outerKeySelector"); } if (innerKeySelector.Parameters.Count != 1) { throw new ArgumentException("Inner key selector must have exactly one parameter.", "innerKeySelector"); } if (resultSelector.Parameters.Count != 2) { throw new ArgumentException("Result selector must have exactly two parameters.", "resultSelector"); } var joinResultSelector = Expression.Lambda(Expression.Constant(null), outerKeySelector.Parameters[0], innerKeySelector.Parameters[0]); JoinExpressionNode = new JoinExpressionNode(parseInfo, innerSequence, outerKeySelector, innerKeySelector, joinResultSelector); ResultSelector = resultSelector; _cachedResultSelector = new ResolvedExpressionCache <Expression> (this); }
public AllExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression predicate) : base(parseInfo, null, null) { ArgumentUtility.CheckNotNull("predicate", predicate); Predicate = predicate; _cachedPredicate = new ResolvedExpressionCache <Expression> (this); }
public ThenByDescendingExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression keySelector) : base(parseInfo) { ArgumentUtility.CheckNotNull("keySelector", keySelector); if (keySelector != null && keySelector.Parameters.Count != 1) { throw new ArgumentException("KeySelector must have exactly one parameter.", "keySelector"); } KeySelector = keySelector; _cachedSelector = new ResolvedExpressionCache <Expression> (this); }
public WhereExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression predicate) : base(parseInfo) { ArgumentUtility.CheckNotNull("predicate", predicate); if (predicate.Parameters.Count != 1) { throw new ArgumentException("Predicate must have exactly one parameter.", "predicate"); } Predicate = predicate; _cachedPredicate = new ResolvedExpressionCache <Expression> (this); }
public AggregateExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression func) : base(parseInfo, null, null) { ArgumentUtility.CheckNotNull("func", func); if (func.Parameters.Count != 2) { throw new ArgumentException("Func must have exactly two parameters.", "func"); } Func = func; _cachedFunc = new ResolvedExpressionCache <LambdaExpression> (this); }
public SelectExpressionNode(MethodCallExpressionParseInfo parseInfo, LambdaExpression selector) : base(parseInfo) { ArgumentUtility.CheckNotNull("selector", selector); if (selector.Parameters.Count != 1) { throw new ArgumentException("Selector must have exactly one parameter.", "selector"); } Selector = selector; _cachedSelector = new ResolvedExpressionCache <Expression> (this); }