public IList <Student> All(Expression <Func <Student, bool> > predicate, bool readOnly = false)
        {
            session.Flush();
            session.Clear();

            IQueryOver <Student, Student> query = session.QueryOver <Student>();

            if (predicate != null)
            {
                query = query.Where(predicate);
            }
            if (readOnly)
            {
                return(query.ReadOnly().List());
            }
            return(query.List());
        }
 private void CopyCriteriaValues(CriteriaImpl criteria, IQueryOver <TRoot, TRoot> query)
 {
     if (!string.IsNullOrEmpty(criteria.CacheRegion))
     {
         query.CacheRegion(criteria.CacheRegion);
     }
     if (criteria.Cacheable)
     {
         query.Cacheable();
     }
     if (criteria.IsReadOnly)
     {
         query.ReadOnly();
     }
     foreach (var pair in criteria.LockModes)
     {
         query.UnderlyingCriteria.SetLockMode(pair.Key, pair.Value);
     }
     if (criteria.Timeout != RowSelection.NoValue)
     {
         query.UnderlyingCriteria.SetTimeout(criteria.Timeout);
     }
 }
 public IQueryOver <TRoot> ReadOnly()
 {
     MainQuery.ReadOnly();
     return(this);
 }