A select clause as part of a select query
Inheritance: System.Linq.Expressions.Expression
Exemple #1
0
        public override Expression VisitSelectClause(SelectClauseExpression selectClauseExpression)
        {
            base.VisitSelectClause(selectClauseExpression);

            string translation;
            switch ((CqlExpressionType)selectClauseExpression.NodeType)
            {
                case CqlExpressionType.SelectAll:
                    translation = "*";
                    break;
                case CqlExpressionType.SelectCount:
                    translation = "COUNT(*)";
                    break;
                case CqlExpressionType.SelectColumns:
                    translation = selectClauseExpression.Distinct ? "DISTINCT " : "";
                    var selectors = selectClauseExpression.Selectors.Select(arg => _translations[arg]);
                    translation += string.Join(",", selectors);
                    break;
                default:
                    throw new Exception("Unexpected type of select clause encountered : " +
                                        selectClauseExpression.NodeType);
            }

            _translations[selectClauseExpression] = translation;
            return selectClauseExpression;
        }
        public SelectStatementExpression(Type type, SelectClauseExpression selectClause, string tableName,
                                         IList<RelationExpression> whereClause, IList<OrderingExpression> orderBy,
                                         int? limit, bool allowFiltering)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            if (selectClause == null)
                throw new ArgumentNullException("selectClause");

            if (tableName == null)
                throw new ArgumentNullException("tableName");

            _type = type;
            _selectClause = selectClause;
            _tableName = tableName;
            _whereClause = whereClause.AsReadOnly();
            _orderBy = orderBy.AsReadOnly();
            _limit = limit;
            _allowFiltering = allowFiltering;
        }
 /// <summary>
 ///   Visits the select clause.
 /// </summary>
 /// <param name="selectClauseExpression"> The select clause expression. </param>
 /// <returns> </returns>
 public virtual Expression VisitSelectClause(SelectClauseExpression selectClauseExpression)
 {
     return base.VisitExtension(selectClauseExpression);
 }