Example #1
0
        public IList List()
        {
            using (session.BeginProcess())
            {
                bool cacheable = session.Factory.Settings.IsQueryCacheEnabled && isCacheable;

                CreateCriteriaLoaders();
                CombineCriteriaQueries();

                if (log.IsDebugEnabled())
                {
                    log.Debug("Multi criteria with {0} criteria queries.", criteriaQueries.Count);
                    for (int i = 0; i < criteriaQueries.Count; i++)
                    {
                        log.Debug("Query #{0}: {1}", i, criteriaQueries[i]);
                    }
                }

                var querySpaces = new HashSet <string>(loaders.SelectMany(l => l.QuerySpaces));
                if (resultSetsCommand.HasQueries)
                {
                    session.AutoFlushIfRequired(querySpaces);
                }
                if (cacheable)
                {
                    criteriaResults = ListUsingQueryCache(querySpaces);
                }
                else
                {
                    criteriaResults = ListIgnoreQueryCache();
                }

                return(criteriaResults);
            }
        }
        public IList List()
        {
            using (session.BeginProcess())
            {
                bool cacheable = session.Factory.Settings.IsQueryCacheEnabled && isCacheable;

                CreateCriteriaLoaders();
                CombineCriteriaQueries();

                if (log.IsDebugEnabled())
                {
                    log.Debug("Multi criteria with {0} criteria queries.", criteriaQueries.Count);
                    for (int i = 0; i < criteriaQueries.Count; i++)
                    {
                        log.Debug("Query #{0}: {1}", i, criteriaQueries[i]);
                    }
                }

                if (cacheable)
                {
                    criteriaResults = ListUsingQueryCache();
                }
                else
                {
                    criteriaResults = ListIgnoreQueryCache();
                }

                return(criteriaResults);
            }
        }