예제 #1
0
 /// <summary>
 /// Evaluates the specified expression.
 /// </summary>
 /// <param name="expression">The expression to evaluate.</param>
 /// <returns>Value of the expression.</returns>
 public QueryValue Visit(LinqMinExpression expression)
 {
     return(this.EvaluateQueryMethodWithLambdaExpression <QueryScalarValue>(
                expression,
                c => c.Min(),
                (c, lambda) => c.Min(lambda)));
 }
예제 #2
0
        /// <summary>
        /// Resolves types for the specified expression.
        /// </summary>
        /// <param name="expression">The expression to resolve types for.</param>
        /// <returns>Expression with resolved types.</returns>
        public QueryExpression Visit(LinqMinExpression expression)
        {
            var source     = this.ResolveTypes(expression.Source);
            var sourceType = ValidateSourceIsACollection(source);
            var lambda     = expression.Lambda != null?this.ResolveLambdaTypes(expression.Lambda, sourceType) : null;

            var expressionType = lambda != null ? lambda.Body.ExpressionType : sourceType.ElementType;

            ExceptionUtilities.Assert(expressionType is QueryScalarType, "Min expression without predicate can only be applied on collections of scalars.");

            return(new LinqMinExpression(source, lambda, expressionType));
        }
예제 #3
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the LinqMinExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Uri query string representing the expression.</returns>
 public virtual string Visit(LinqMinExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
예제 #4
0
 /// <summary>
 /// Generates System.CodeDom.CodeExpression from the given expression.
 /// </summary>
 /// <param name="expression">Expression from which System.CodeDom.CodeExpression is generated.</param>
 /// <returns>Generated System.CodeDom.CodeExpression.</returns>
 public virtual CodeExpression Visit(LinqMinExpression expression)
 {
     return(this.VisitQueryMethodWithLambdaExpression(expression, "Min"));
 }
예제 #5
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the LinqMinExpression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Replaced expression.</returns>
 public virtual QueryExpression Visit(LinqMinExpression expression)
 {
     return(this.VisitQueryMethodWithLambdaExpression(expression, (s, l, t) => new LinqMinExpression(s, l, t)));
 }