public IDetachedQuery TransformToRowCount()
 {
     Select s = new Select("count(*)");
     s.SetFrom(from.FromWhereClause());
     DetachedQuery result = new DetachedQuery(s.Clause);
     result.CopyParametersFrom(this);
     return result;
 }
 protected override IDetachedQuery GetDetachedQuery()
 {
     if (origin != null)
     {
         var result = new DetachedQuery("select count(*) " + origin.Hql);
         result.CopyParametersFrom(origin);
         return result;
     }
     return detachedQuery;
 }