/// <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)); }
/// <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"); }
/// <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")); }
/// <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)); }
/// <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))); }