Ejemplo n.º 1
0
        /// <inheritdoc/>
        public IReadOnlyCollection <ExpressionInScope> GetConstraints()
        {
            var context = new PaginationContext();

            foreach (var element in _pageSizeConstraint?.Elements ?? Array.Empty <PaginationElementQueryStringValueExpression>())
            {
                var entry = context.ResolveEntryInScope(element.Scope);
                entry.PageSize       = element.Value == 0 ? null : new PageSize(element.Value);
                entry.HasSetPageSize = true;
            }

            foreach (var element in _pageNumberConstraint?.Elements ?? Array.Empty <PaginationElementQueryStringValueExpression>())
            {
                var entry = context.ResolveEntryInScope(element.Scope);
                entry.PageNumber = new PageNumber(element.Value);
            }

            context.ApplyOptions(_options);

            return(context.GetExpressionsInScope());
        }