예제 #1
0
        private static IQueryable ApplyToImplementation(IQueryable query, SkipTokenQueryOption skipTokenQueryOption,
                                                        ODataQuerySettings querySettings, ODataQueryOptions queryOptions)
        {
            if (query == null)
            {
                throw Error.ArgumentNull(nameof(query));
            }

            if (skipTokenQueryOption == null)
            {
                throw Error.ArgumentNull(nameof(skipTokenQueryOption));
            }

            if (querySettings == null)
            {
                throw Error.ArgumentNull(nameof(querySettings));
            }

            ODataQueryContext context = skipTokenQueryOption.Context;

            if (context.ElementClrType == null)
            {
                throw Error.NotSupported(SRResources.ApplyToOnUntypedQueryOption, "ApplyTo");
            }

            IList <OrderByNode> orderByNodes = null;

            if (queryOptions != null)
            {
                OrderByQueryOption orderBy = queryOptions.GenerateStableOrder();
                if (orderBy != null)
                {
                    orderByNodes = orderBy.OrderByNodes;
                }
            }

            return(ApplyToCore(query, querySettings, orderByNodes, skipTokenQueryOption.Context, skipTokenQueryOption.RawValue));
        }
예제 #2
0
 /// <summary>
 /// Apply the $skiptoken query to the given IQueryable.
 /// </summary>
 /// <param name="query">The original <see cref="IQueryable"/>, not null.</param>
 /// <param name="skipTokenQueryOption">The skiptoken query option which needs to be applied to this query option, not null.</param>
 /// <param name="querySettings">The query settings to use while applying this query option, not null.</param>
 /// <param name="queryOptions">Information about the other query options, could be null.</param>
 /// <returns>The new <see cref="IQueryable"/> after the skiptoken query has been applied to.</returns>
 public override IQueryable ApplyTo(IQueryable query, SkipTokenQueryOption skipTokenQueryOption,
                                    ODataQuerySettings querySettings, ODataQueryOptions queryOptions)
 {
     return(ApplyToImplementation(query, skipTokenQueryOption, querySettings, queryOptions));
 }