コード例 #1
0
ファイル: QueryModel.cs プロジェクト: zhonli/odata.net
        public void Sort(bool bAsc)
        {
            //Sub model - sort
            SortModel   model  = new SortModel(this._workspace, _fromContainer.BaseType);
            ModelEngine engine = new ModelEngine(this.Engine, model);

            engine.Run();

            PropertyExpression[] ordervalues = model.SortResult;

            if (_query is TopExpression)
            {
                _query = ((TopExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is SkipExpression)
            {
                _query = ((SkipExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is CountExpression)
            {
                _query = ((CountExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is ExpandExpression)
            {
                _query = ((ExpandExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is NavigationExpression)
            {
                _query = ((NavigationExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is PredicateExpression)
            {
                _query = ((PredicateExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }
            else if (_query is ScanExpression)
            {
                _query = ((ScanExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            }

            bSort     = true;
            _action   = LastAction.OrderBy;
            bIsOption = true;
            AstoriaTestLog.WriteLineIgnore(".OrderBy(" + ordervalues.ToString() + ")");
        }
コード例 #2
0
ファイル: QueryModel.cs プロジェクト: AlineGuan/odata.net
        public void Sort(bool bAsc)
        {
            //Sub model - sort
            SortModel model = new SortModel(this._workspace, _fromContainer.BaseType);
            ModelEngine engine = new ModelEngine(this.Engine, model);
            engine.Run();

            PropertyExpression[] ordervalues = model.SortResult;

           if (_query is TopExpression)
                _query = ((TopExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            else if (_query is SkipExpression)
                _query = ((SkipExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            else if (_query is CountExpression)
                _query = ((CountExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            else if (_query is ExpandExpression)
                _query = ((ExpandExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
            else if (_query is NavigationExpression)
                _query = ((NavigationExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
           else if (_query is PredicateExpression)
               _query = ((PredicateExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;
           else if (_query is ScanExpression)
               _query = ((ScanExpression)_query).Sort(ordervalues, bAsc) as OrderByExpression;

            bSort = true;
            _action = LastAction.OrderBy;
            bIsOption = true;
            AstoriaTestLog.WriteLineIgnore(".OrderBy(" + ordervalues.ToString() + ")");
        }