public T FindFirst(DetachedCriteria criteria, params Order[] orders)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, orders);

            crit.SetFirstResult(0);
            crit.SetMaxResults(1);
            return(crit.UniqueResult <T>());
        }
        public long Count(DetachedCriteria criteria)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, null);

            crit.SetProjection(Projections.RowCount());
            object countMayBe_Int32_Or_Int64_DependingOnDatabase = crit.UniqueResult();

            return(Convert.ToInt64(countMayBe_Int32_Or_Int64_DependingOnDatabase));
        }
        public ICollection <T> FindAll(DetachedCriteria criteria, params Order[] orders)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, orders);

            return(crit.List <T>());
        }
        public ICollection <ProjT> ReportAll <ProjT>(bool distinctResults, DetachedCriteria criteria, ProjectionList projectionList, params Order[] orders)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, orders);

            return(DoReportAll <ProjT>(crit, projectionList, distinctResults));
        }
        public ICollection <ProjT> ReportAll <ProjT>(bool distinctResults, ProjectionList projectionList)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, null, null);

            return(DoReportAll <ProjT>(crit, projectionList, distinctResults));
        }
        public ProjT ReportOne <ProjT>(DetachedCriteria criteria, ProjectionList projectionList)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, null);

            return(DoReportOne <ProjT>(crit, projectionList));
        }
        public T FindOne(DetachedCriteria criteria)
        {
            ICriteria crit = RepositoryHelper <T> .GetExecutableCriteria(Session, criteria, null);

            return(crit.UniqueResult <T>());
        }