/// <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); }
protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression) { throw new NotImplementedException(); }
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); } }
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); }
/// <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; }
protected override void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression) { //Nothing to do. }
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(); }
protected abstract void VisitSort(IFragmentBuilder parent, IQueryGraphBuilder graph, ISortBuilder expression);