Пример #1
0
        /// <summary>
        /// 解析 orderby 语句
        /// </summary>
        /// <param name="orderByClause"></param>
        /// <param name="queryModel"></param>
        /// <param name="index"></param>
        public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
        {
            foreach (var ordering in orderByClause.Orderings)
            {
                OracleOrderByPartsCommandBuilder orderBuilder = new OracleOrderByPartsCommandBuilder();

                OracleOrderByClauseVisitor visitor = new OracleOrderByClauseVisitor();

                visitor.Translate(ordering.Expression, orderBuilder);

                string direction = ordering.OrderingDirection == OrderingDirection.Desc ? "desc" : "asc";

                commandBuilder.OrderByParts.Add(string.Format("{0} {1}", orderBuilder.ToString(), direction));
            }

            base.VisitOrderByClause(orderByClause, queryModel, index);
        }
Пример #2
0
        /// <summary>
        /// 翻译表达式
        /// </summary>
        /// <returns></returns>
        public void Translate(Expression expression, OracleOrderByPartsCommandBuilder commandBuilder)
        {
            this.commandBuilder = commandBuilder;

            this.VisitExpression(expression);
        }