コード例 #1
0
        public static void ParseFilter(this ODataUriParser query, Query result)
        {
            SearchClause search;

            try
            {
                search = query.ParseSearch();
            }
            catch (ODataException ex)
            {
                throw new ValidationException("Query $search clause not valid.", new ValidationError(ex.Message));
            }

            if (search != null)
            {
                result.FullText = SearchTermVisitor.Visit(search.Expression).ToString();
            }

            FilterClause filter;

            try
            {
                filter = query.ParseFilter();
            }
            catch (ODataException ex)
            {
                throw new ValidationException("Query $filter clause not valid.", new ValidationError(ex.Message));
            }

            if (filter != null)
            {
                result.Filter = FilterVisitor.Visit(filter.Expression);
            }
        }
コード例 #2
0
ファイル: FilterBuilder.cs プロジェクト: wilmshurstm/squidex
        public static void ParseFilter(this ODataUriParser query, ClrQuery result)
        {
            SearchClause searchClause;

            try
            {
                searchClause = query.ParseSearch();
            }
            catch (ODataException ex)
            {
                var error = T.Get("common.odataSearchNotValid", new { message = ex.Message });

                throw new ValidationException(error, ex);
            }

            if (searchClause != null)
            {
                result.FullText = SearchTermVisitor.Visit(searchClause.Expression).ToString();
            }

            FilterClause filterClause;

            try
            {
                filterClause = query.ParseFilter();
            }
            catch (ODataException ex)
            {
                var error = T.Get("common.odataFilterNotValid", new { message = ex.Message });

                throw new ValidationException(error, ex);
            }

            if (filterClause != null)
            {
                var filter = FilterVisitor.Visit(filterClause.Expression);

                result.Filter = Optimizer <ClrValue> .Optimize(filter);
            }
        }