Ejemplo n.º 1
0
        public Expression2SqlCore <T> Count(Expression <Func <T, object> > expression = null)
        {
            this._sqlPack.Clear();
            this._sqlPack.IsSingleTable = true;
            if (expression == null)
            {
                this._sqlPack.Sql.AppendFormat("select count(*) from {0}", ModelCache <T> ._TableName);
            }
            else
            {
                Expression2SqlProvider.Count(expression.Body, this._sqlPack);
            }

            return(this);
        }
Ejemplo n.º 2
0
        public ExpressionToSql <T> Count(Expression <Func <T, object> > expression = null)
        {
            this.Clear();
            if (expression == null)
            {
                string tableName = typeof(T).Name;

                this._sqlBuilder.SetTableAlias(tableName);
                string tableAlias = this._sqlBuilder.GetTableAlias(tableName);

                if (!string.IsNullOrWhiteSpace(tableAlias))
                {
                    tableName += " " + tableAlias;
                }
                this._sqlBuilder.AppendFormat("select count(*) from {0}", tableName);
            }
            else
            {
                Expression2SqlProvider.Count(expression.Body, this._sqlBuilder);
            }

            return(this);
        }
 protected override SqlBuilder Count(ParameterExpression expression, SqlBuilder sqlBuilder)
 {
     Expression2SqlProvider.Count(expression, sqlBuilder);
     return(sqlBuilder);
 }
Ejemplo n.º 4
0
 protected override SqlBuilder Count(UnaryExpression expression, SqlBuilder sqlBuilder)
 {
     Expression2SqlProvider.Count(expression.Operand, sqlBuilder);
     return(sqlBuilder);
 }
Ejemplo n.º 5
0
 protected override SqlPack Count(UnaryExpression expression, SqlPack sqlPack)
 {
     Expression2SqlProvider.Count(expression.Operand, sqlPack);
     return(sqlPack);
 }