public Task <long> GetCountAsync <TEntity>(TEntity entity)
            where TEntity : ITableDto
        {
            var query = queryFactory.GetCountQuery <TEntity>();

            logger.LogDebug("GetCountAsync query:{query} entity:{@entity}", query, entity);

            return(uk.DbConnection.ExecuteScalarAsync <long>(query, entity, uk.DbTransaction));
        }
        public long GetCount <TEntity>(TEntity entity)
            where TEntity : class
        {
            var query = queryFactory.GetCountQuery <TEntity>();

            // logger.LogDebug("GetCountAsync query:{query} entity:{@entity}", query, entity);

            return(Conn.ExecuteScalar <long>(query, entity, Tran));
        }
Example #3
0
        public async Task <long> GetCountAsync()
        {
            // var sql = $"SELECT count(*) " +
            //   $"FROM {ProcessHistoryDto.TableName} ";

            var tableName = tableQuery.GetTable <ProcessHistoryDto>().Name;
            var sql       = $"SELECT count(*) FROM {tableName}";

            sql = tableQuery.GetCountQuery <ProcessHistoryDto>();

            var count = await DbConnection.ExecuteScalarAsync <long>(sql, DbTransaction);

            return(count);
        }