Example #1
0
 static string OrderByItemStr(OrderByExpr orderBy, SqlExprParams pars)
 {
     return
         ($"{SqlExpression.ExprToSql(orderBy.Expr.Body, pars.ReplaceSelectParams(orderBy.Expr.Parameters[0], null), true)} " +
          $"{(orderBy.Order == OrderByOrder.Asc ? "ASC" : orderBy.Order == OrderByOrder.Desc ? "DESC" : throw new ArgumentException())}" +
          $"{(orderBy.Nulls == OrderByNulls.NullsFirst ? " NULLS FIRST" : orderBy.Nulls == OrderByNulls.NullsLast ? " NULLS LAST" : "")}");
 }
Example #2
0
        public static IQueryOrderBy Field(Type type, string field, QueryOrderType orderType)
        {
            var expressionOrderBy =
                (AbstractExpressionOrderBy)_factory.CreateOrderBy(QueryOrderByExpressionType.Expression);

            expressionOrderBy.Expr      = OrderByExpr.Build().Field(type, field);
            expressionOrderBy.OrderType = orderType;
            return(expressionOrderBy);
        }