Beispiel #1
0
        /// <inheritdoc cref="UnaryExpression.Update(Expression)" select="summary"/>
        public LetClause Update(ParameterExpression variable, Expression expression)
        {
            if (Variable == variable && Expression == expression)
            {
                return(this);
            }

            return(Expressive.Let(variable, expression));
        }
Beispiel #2
0
        private QueryClause VisitSelect(MethodCallExpression node, LambdaExpression selector)
        {
            if (selector.Body is NewExpression @new)
            {
                // let {variable} = {expression}
                PropertyInfo        prop     = (PropertyInfo)@new.Members[1];
                ParameterExpression variable = GetVariable(prop.PropertyType, prop.Name);

                return(Expressive.Let(variable, @new.Arguments[1]));
            }

            if (true)
            {
                // select {expression}
                return(Expressive.Select(selector.Body));
            }
            else
            {
            }

            return(null);
        }
Beispiel #3
0
        private QueryClause VisitContinuationClause(QueryClauseSyntax clause)
        {
            switch (clause)
            {
            case FromClauseSyntax from:
                return(Expressive.From(null, from.Expression.Accept(this)));

            case LetClauseSyntax let:
                return(Expressive.Let(null, let.Expression.Accept(this)));

            case JoinClauseSyntax join:
                return(Expressive.Join(null, join.InExpression.Accept(this), join.LeftExpression.Accept(this), join.RightExpression.Accept(this)));

            case WhereClauseSyntax where:
                return(Expressive.Where(where.Condition.Accept(this)));

            case OrderByClauseSyntax orderby:
                return(Expressive.OrderBy(Utils.Select(@orderby.Orderings, x => Expressive.Ordering(x.Expression.Accept(this), x.AscendingOrDescendingKeyword.Text == "ascending"))));

            default:
                throw new ArgumentException("Invalid clause.");
            }
        }