Ejemplo n.º 1
0
        internal static long RowCount <T>(this IDbCommand dbCmd, SqlExpression <T> expression)
        {
            //ORDER BY throws when used in subselects in SQL Server. Removing OrderBy() clause since it doesn't impact results
            var countExpr = expression.Clone().OrderBy();

            return(dbCmd.Scalar <long>(dbCmd.GetDialectProvider().ToRowCountStatement(countExpr.ToSelectStatement()), expression.Params));
        }
Ejemplo n.º 2
0
        internal static Task <long> RowCountAsync <T>(this IDbCommand dbCmd, SqlExpression <T> expression, CancellationToken token)
        {
            var countExpr = expression.Clone().OrderBy();

            return(dbCmd.ScalarAsync <long>(dbCmd.GetDialectProvider().ToRowCountStatement(countExpr.ToSelectStatement()), countExpr.Params, token));
        }
 public IUntypedSqlExpression Clone()
 {
     q.Clone();
     return(this);
 }