Ejemplo n.º 1
0
        public ICriterion GetCriterion()
        {
            ICriterion criterion = null;
            IHqlSearchCriterionItem item2;
            ICriterion         criterion2;
            IList <ICriterion> source = new List <ICriterion>();

            foreach (CommonSearchCriterionItem item in base.Searches)
            {
                item2      = new HqlCommonSearchCriterionItem(item);
                criterion2 = item2.GetCriterion();
                if (criterion2 != null)
                {
                    source.Add(criterion2);
                }
            }
            foreach (FTSearchCriterionItem item3 in base.FTSearches)
            {
                item2      = new HqlFTSearchCriterionItem(this.FtCritBuilder, item3);
                criterion2 = item2.GetCriterion();
                if (criterion2 != null)
                {
                    source.Add(criterion2);
                }
            }
            foreach (JunctionSearchCriterionItem item4 in base.JuncSearches)
            {
                item2      = new HqlJunctionSearchCriterionItem(item4);
                criterion2 = item2.GetCriterion();
                if (criterion2 != null)
                {
                    source.Add(criterion2);
                }
            }
            if (source.Count <= 0)
            {
                return(criterion);
            }
            if (base.JunctionMode == JunctionMode.And)
            {
                return(SearchHelper.IntersectCriterions(source.ToArray <ICriterion>()));
            }
            return(SearchHelper.UnionCriterions(source.ToArray <ICriterion>()));
        }
Ejemplo n.º 2
0
        public DetachedCriteria GetDetachedCriteriaWithoutOrder <T>()
        {
            DetachedCriteria criteria            = DetachedCriteria.For(typeof(T));
            HqlJunctionSearchCriterionItem item2 = new HqlJunctionSearchCriterionItem(base.Searches)
            {
                FtCritBuilder = this._ftCritBuilder
            };
            ICriterion criterion = item2.GetCriterion();

            if (criterion != null)
            {
                criteria.Add(criterion);
            }
            if (this.IsDistinct)
            {
                criteria.SetResultTransformer(new DistinctRootEntityResultTransformer());
            }
            return(criteria);
        }