Example #1
0
 public void SelectTop <T>(SqlFragment parent, SelectTop <T> selectTop) where T : IStatement
 {
     this.Script.Append("SELECT TOP (");
     this.Script.AppendFragment(selectTop.Count, parent, this);
     this.Script.Append(")");
     ExpressionFormatter.FormatExpressionList(selectTop.ColumnList, parent, this.Script, this);
 }
Example #2
0
        public SelectTop <SingleExprSelectStatement> SelectTop(Expression top, Expression expression)
        {
            var statement = new SingleExprSelectStatement(this);
            var clause    = new SelectTop <SingleExprSelectStatement>(statement, top, new[] { expression });

            statement.FirstFragment = clause;
            return(clause);
        }
Example #3
0
        public SelectTop <SelectStatement> SelectTop(Expression top, IEnumerable <Expression> expressions)
        {
            var statement = new SelectStatement(this);
            var clause    = new SelectTop <SelectStatement>(statement, top, expressions);

            statement.FirstFragment = clause;
            return(clause);
        }
Example #4
0
        public SelectTop <SelectStatement> SelectOne(IEnumerable <Expression> expressions)
        {
            if (expressions == null)
            {
                throw new ArgumentNullException("expressions");
            }
            var statement = new SelectStatement(this);
            var clause    = new SelectTop <SelectStatement>(statement, 1, expressions);

            statement.FirstFragment = clause;
            return(clause);
        }
Example #5
0
        public SelectTop <SingleExprSingleRowSelectStatement> SelectOne(Expression expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }
            var statement = new SingleExprSingleRowSelectStatement(this);
            var clause    = new SelectTop <SingleExprSingleRowSelectStatement>(statement, 1, new[] { expression });

            statement.FirstFragment = clause;
            return(clause);
        }
Example #6
0
        public SelectTop <SelectStatement> SelectTop(
            Expression top,
            Expression expression,
            params Expression[] expressions)
        {
            var statement = new SelectStatement(this);
            var clause    = new SelectTop <SelectStatement>(
                statement,
                top,
                Collection <Expression> .From(expression, expressions));

            statement.FirstFragment = clause;
            return(clause);
        }