/// <summary> /// Transform an gigen <see cref="DetachedQuery"/> (HQL query) to it's rows count. /// </summary> /// <param name="origin">The given <see cref="DetachedQuery"/>.</param> /// <returns> /// A <see cref="QueryRowsCounter"/> based on <paramref name="origin"/>, with row count, using /// same parameters and it's values. /// </returns> /// <exception cref="HibernateException">When the query don't start with 'from' clause.</exception> /// <remarks> /// Take care to the query; it can't contain any other clause than "from" and "where". /// Set the parameters and it's values, of <paramref name="origin"/> befor call this method. /// </remarks> public static QueryRowsCounter Transforming(DetachedQuery origin) { if (origin == null) { throw new ArgumentNullException("origin"); } if (!origin.Hql.StartsWith("from", StringComparison.InvariantCultureIgnoreCase)) { throw new HibernateException( string.Format("Can't trasform the HQL to it's counter, the query must start with 'from' clause:{0}", origin.Hql)); } var result = new QueryRowsCounter(origin); return(result); }
/// <summary> /// Transform an gigen <see cref="DetachedQuery"/> (HQL query) to it's rows count. /// </summary> /// <param name="origin">The given <see cref="DetachedQuery"/>.</param> /// <returns> /// A <see cref="QueryRowsCounter"/> based on <paramref name="origin"/>, with row count, using /// same parameters and it's values. /// </returns> /// <exception cref="HibernateException">When the query don't start with 'from' clause.</exception> /// <remarks> /// Take care to the query; it can't contain any other clause than "from" and "where". /// Set the parameters and it's values, of <paramref name="origin"/> befor call this method. /// </remarks> public static QueryRowsCounter Transforming(DetachedQuery origin) { if (origin == null) { throw new ArgumentNullException("origin"); } if (!origin.Hql.StartsWith("from", StringComparison.InvariantCultureIgnoreCase)) { throw new HibernateException( string.Format("Can't trasform the HQL to it's counter, the query must start with 'from' clause:{0}", origin.Hql)); } var result = new QueryRowsCounter(origin); return result; }