/// <summary>
 /// Adds the item as a sort condition to the window.
 /// </summary>
 /// <param name="orderBy">The order by to add.</param>
 public void AddOrderBy(OrderBy orderBy)
 {
     if (orderBy == null)
     {
         throw new ArgumentNullException("orderBy");
     }
     orderByItems.Add(orderBy);
 }
 /// <summary>
 /// Generates the text for an OrderBy builder.
 /// </summary>
 /// <param name="item">The OrderBy builder to generate the text for.</param>
 protected internal override void VisitOrderBy(OrderBy item)
 {
     visitAliasedProjection(item.Projection);
     if (item.Order != Order.Default)
     {
         writer.Write(" ");
         OrderConverter converter = new OrderConverter();
         writer.Write(converter.ToString(item.Order));
     }
     if (item.NullPlacement != NullPlacement.Default)
     {
         writer.Write(" ");
         NullPlacementConverter converter = new NullPlacementConverter();
         writer.Write(converter.ToString(item.NullPlacement));
     }
 }
 /// <summary>
 /// Removes the sort criteria from the query.
 /// </summary>
 /// <param name="item">The order by item to remove.</param>
 /// <returns>True if the item was removed; otherwise, false.</returns>
 public bool RemoveOrderBy(OrderBy item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     return _orderBy.Remove(item);
 }
 /// <summary>
 /// Adds a sort criteria to the query.
 /// </summary>
 /// <param name="item">The sort criteria to add.</param>
 public void AddOrderBy(OrderBy item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     _orderBy.Add(item);
 }
 private void buildOrderByItem(MatchResult result, List<OrderBy> orderByList)
 {
     MatchResult expressionResult = result.Matches[SqlGrammar.OrderByItem.Expression];
     IProjectionItem expression = (IProjectionItem)buildArithmeticItem(expressionResult);
     Order order = Order.Default;
     MatchResult directionResult = result.Matches[SqlGrammar.OrderByItem.OrderDirection];
     if (directionResult.IsMatch)
     {
         order = buildOrderDirection(directionResult);
     }
     NullPlacement placement = NullPlacement.Default;
     MatchResult placementResult = result.Matches[SqlGrammar.OrderByItem.NullPlacement];
     if (placementResult.IsMatch)
     {
         placement = buildNullPlacement(placementResult);
     }
     OrderBy orderBy = new OrderBy(expression, order, placement);
     orderByList.Add(orderBy);
 }
 /// <summary>
 /// Removes the item as a sort condition to the window.
 /// </summary>
 /// <param name="orderBy">The order by to remove.</param>
 /// <returns>True if the order by was removed; otherwise, false.</returns>
 public bool RemoveOrderBy(OrderBy orderBy)
 {
     if (orderBy == null)
     {
         throw new ArgumentNullException("orderBy");
     }
     return orderByItems.Remove(orderBy);
 }
 /// <summary>
 /// Visits a OrderBy builder.
 /// </summary>
 /// <param name="item">The item to visit.</param>
 protected internal virtual void VisitOrderBy(OrderBy item)
 {
 }