Exemplo n.º 1
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(LinqFirstExpression expression)
        {
            var source     = this.ResolveTypes(expression.Source);
            var sourceType = ValidateSourceIsACollection(source);
            var lambda     = expression.Lambda != null?this.ResolveLambdaTypes(expression.Lambda, sourceType) : null;

            return(new LinqFirstExpression(source, lambda, sourceType.ElementType));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Visits a QueryExpression tree whose root node is the LinqFirstExpression.
 /// </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(LinqFirstExpression expression)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
Exemplo n.º 3
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(LinqFirstExpression expression)
 {
     return(this.VisitQueryMethodWithLambdaExpression(expression, "First"));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Evaluates the specified expression.
 /// </summary>
 /// <param name="expression">The expression to evaluate.</param>
 /// <returns>Value of the expression.</returns>
 public virtual QueryValue Visit(LinqFirstExpression expression)
 {
     return(this.VisitFirstExpression(expression, false));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Replaces the given expression.
 /// </summary>
 /// <param name="expression">The root node of the expression tree being visited.</param>
 /// <returns>Replaced expression.</returns>
 public virtual QueryExpression Visit(LinqFirstExpression expression)
 {
     return(this.VisitQueryMethodWithLambdaExpression(expression, (s, l, t) => new LinqFirstExpression(s, l, t)));
 }