예제 #1
0
        /// <summary>
        /// Adds a sort builder.
        /// </summary>
        /// <param name="sort"></param>
        /// <returns></returns>
        public SearchBuilder Sort(ISortBuilder sort)
        {
            if (_sorts == null)
            {
                _sorts = new List <ISortBuilder>();
            }

            _sorts.Add(sort);
            return(this);
        }
예제 #2
0
 protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression)
 {
     throw new NotImplementedException();
 }
예제 #3
0
        protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression)
        {
            if (expression.Expressions.Any())
            {
                return;
            }
            var filter = graph.Fragment <IFilterBuilder>();

            if (!filter.Limit.HasValue && !filter.Offset.HasValue)
            {
                return;
            }
            var table = graph.Source.Tables.FirstOrDefault();

            if (table == null)
            {
                throw new NotImplementedException();
            }
            var sort = graph.Parent.Fragment <ISortBuilder>();

            if (sort != null)
            {
                expression.Expressions.AddRange(sort.GetColumns(table.Table));
            }
            if (expression.IsEmpty())
            {
                expression.AddColumns(table.Table.PrimaryKeys);
            }
        }
예제 #4
0
 protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression)
 {
     if (EnsureOrderBy.Predicate(parent, graph, expression))
     {
         new EnsureOrderBy(this.Database).Visit(parent, graph, expression);
     }
     base.VisitSort(parent, graph, expression);
 }
예제 #5
0
        /// <summary>
        /// Adds a sort builder.
        /// </summary>
        /// <param name="sort"></param>
        /// <returns></returns>
        public SearchBuilder Sort(ISortBuilder sort)
        {
            if (_sorts == null)
            {
                _sorts = new List<ISortBuilder>();
            }

            _sorts.Add(sort);
            return this;
        }
예제 #6
0
 protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression)
 {
     //Nothing to do.
 }
예제 #7
0
 protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression)
 {
     this.Push(new SqlOrderByWriter(parent, graph, this.Database, this, this.Parameters));
     this.Peek.Write(expression);
     this.Pop();
 }
예제 #8
0
 protected abstract void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression);