/// <summary>
        /// Finds out if the given <paramref name="orderingInfo"/> required a skip token 
        /// expression in the expansion
        /// </summary>
        /// <param name="orderingInfo">Input orderingInfo.</param>
        /// <returns>true if skip token expression is needed, false otherwise</returns>
        internal static bool IsSkipTokenRequired(OrderingInfo orderingInfo)
        {
            if (orderingInfo != null && orderingInfo.IsPaged)
            {
                foreach (OrderingExpression o in orderingInfo.OrderingExpressions)
                {
                    LambdaExpression l = (LambdaExpression)o.Expression;
                    NeedSkipTokenVisitor visitor = new NeedSkipTokenVisitor();
                    visitor.Visit(l.Body);
                    if (visitor.NeedSkipToken)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
示例#2
0
        /// <summary>
        /// Finds out if the given <paramref name="orderingInfo"/> required a skip token
        /// expression in the expansion
        /// </summary>
        /// <param name="orderingInfo">Input orderingInfo.</param>
        /// <returns>true if skip token expression is needed, false otherwise</returns>
        internal static bool IsSkipTokenRequired(OrderingInfo orderingInfo)
        {
            if (orderingInfo != null && orderingInfo.IsPaged)
            {
                foreach (OrderingExpression o in orderingInfo.OrderingExpressions)
                {
                    LambdaExpression     l       = (LambdaExpression)o.Expression;
                    NeedSkipTokenVisitor visitor = new NeedSkipTokenVisitor();
                    visitor.Visit(l.Body);
                    if (visitor.NeedSkipToken)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#3
0
        /// <summary>
        /// Obtains a collection of resource properties that are needed for skip token generation
        /// </summary>
        /// <param name="orderingInfo">Input orderingInfo.</param>
        /// <param name="rt">Resource type for which to collect the skip token properties</param>
        /// <returns>Collection of resource properties used in $skiptoken</returns>
        internal static ICollection <ResourceProperty> CollectSkipTokenProperties(OrderingInfo orderingInfo, ResourceType rt)
        {
            Debug.Assert(orderingInfo != null, "Must have valid ordering information to collect skip token properties");
            Debug.Assert(orderingInfo.IsPaged, "Must have paging enabled to collection skip token properties");

            List <ResourceProperty> resourceProperties = new List <ResourceProperty>();

            foreach (OrderingExpression o in orderingInfo.OrderingExpressions)
            {
                LambdaExpression     l       = (LambdaExpression)o.Expression;
                NeedSkipTokenVisitor visitor = new NeedSkipTokenVisitor(rt);
                visitor.Visit(l.Body);
                if (visitor.NeedSkipToken)
                {
                    return(null);
                }

                Debug.Assert(visitor.Property != null, "Must have a valid property if skip token is not needed");
                resourceProperties.Add(visitor.Property);
            }

            return(resourceProperties);
        }
        /// <summary>
        /// Obtains a collection of resource properties that are needed for skip token generation
        /// </summary>
        /// <param name="orderingInfo">Input orderingInfo.</param>
        /// <param name="rt">Resource type for which to collect the skip token properties</param>
        /// <returns>Collection of resource properties used in $skiptoken</returns>
        internal static ICollection<ResourceProperty> CollectSkipTokenProperties(OrderingInfo orderingInfo, ResourceType rt)
        {
            Debug.Assert(orderingInfo != null, "Must have valid ordering information to collect skip token properties");
            Debug.Assert(orderingInfo.IsPaged, "Must have paging enabled to collection skip token properties");

            List<ResourceProperty> resourceProperties = new List<ResourceProperty>();
            foreach (OrderingExpression o in orderingInfo.OrderingExpressions)
            {
                LambdaExpression l = (LambdaExpression)o.Expression;
                NeedSkipTokenVisitor visitor = new NeedSkipTokenVisitor(rt);
                visitor.Visit(l.Body);
                if (visitor.NeedSkipToken)
                {
                    return null;
                }

                Debug.Assert(visitor.Property != null, "Must have a valid property if skip token is not needed");
                resourceProperties.Add(visitor.Property);
            }

            return resourceProperties;
        }