public ExpressionToSqlmpl <T> Count(Expression <Func <T, object> > expression = null) { this.Clear(); if (expression == null) { string tableName = GetTableName(typeof(T).Name); _sqlBuilder.SetTableAlias(tableName); string tableAlias = _sqlBuilder.GetTableAlias(tableName); if (!string.IsNullOrWhiteSpace(tableAlias)) { tableName += " " + tableAlias; } _sqlBuilder.AppendFormat("select count(*) from {0}", tableName); } else { ExpressionToSqlProvider.Count(expression.Body, this._sqlBuilder); } return(this); }
protected override SqlBuilder Count(UnaryExpression expression, SqlBuilder sqlBuilder) { ExpressionToSqlProvider.Count(expression.Operand, sqlBuilder); return(sqlBuilder); }
protected override SqlBuilder Count(ParameterExpression expression, SqlBuilder sqlBuilder) { ExpressionToSqlProvider.Count(expression, sqlBuilder); return(sqlBuilder); }