Repository navigation
FAQ and Troubleshooting
You probably returned Results.Ok(paged.Response) or relied on the upstream ResultToHttpResult.ToHttpResult<T> adapter, which only serializes result.Response and drops the envelope. Switch to:
return paged.ToPagedHttpResult(ctx);Check that:
-
AddPagedListResultWeb(...)is called fromProgram.cs. Without itPagedResultActionFilteris not registered. - The action returns an
ObjectResultor aJsonResult(whichPagedOkResultdoes). If it returns a customIActionResultwhoseValueis not exposed through a publicValueproperty, the header writer cannot find the paged envelope. -
EmitTotalCountHeaderistrue(it is by default). The fourX-*headers are toggled together by this flag.
For minimal-API endpoints, the MVC filter does not run; you must attach the endpoint filter via WithPagedResult() on the route group or endpoint.
PagedRequestModelBinderProvider only kicks in when:
- the parameter type is assignable from
PagedRequest; - the binding source is
BindingSource.Query(i.e.[FromPagedQuery]is present); - the parameter is a complex type (so simple
int/stringquery bindings are not affected).
If any of those is missing, the default complex-object binder takes over and you get an empty PagedRequest. Verify the attribute is present and that AddPagedListResultWeb has been called.
QueryableExtensions.GetDbContext(IQueryable) uses reflection to extract the DbContext instance from an EF Core IQueryable. EF Core marks the underlying members as internal and surfaces an EF1001 analyzer warning when they are accessed. This is expected. The reflection is intentional, the access pattern is stable across the supported EF Core versions, and the call is only used to resolve DefaultPrimaryKeyDefinition for the predefined-records pipeline. You can suppress the warning at file scope:
#pragma warning disable EF1001For minimal APIs, pass null to ToPagedHttpResult and the helper will return Results.NoContent() automatically. For MVC, add the check explicitly:
if (paged is null) return NoContent();
return PagedOkResult(paged);The most common reasons:
- You called
GetPagedAsyncinstead ofGetPagedWithMainFiltersAsyncorGetPagedWithFiltersAsync. The simple variant ignores theFilterscollection. - The request type is
PagedRequest, notPageRequestWithFilters. The base type does not carry aFilterscollection, so the filter pipeline has nothing to read. - The property names in the filters are not in the
AllowedFilterset of the registeredPageableMetadata; the binder removed them. Check the binding errors underfilter[i]keys.
builder.Services.AddPagedListResultWeb(o =>
{
o.StatusCodeMapper = (result, defaultCode) => StatusCodes.Status422UnprocessableEntity;
});The mapper is called by the upstream IProblemDetailsResultFactory whenever a paged result is serialized as ProblemDetails.
Set PagedListResultWebOptions.JsonSerializerOptions. The minimal-API ToPagedHttpResult reads the value and passes it to Results.Ok(paged, options). For MVC, configure the framework JSON pipeline as usual (AddJsonOptions(...)) — paged endpoints inherit those settings because the body is just an ObjectResult.
By design. RFC 5988 navigation only makes sense for safe, idempotent verbs and for endpoints whose URL is itself the canonical representation of the request. The library emits Link only when the verb is GET and PageCount > 0. If you serve a paginated POST, build the Link header yourself or expose a parallel GET endpoint.
Two reasons: (1) EmitServerTimingHeader defaults to false; set it to true in the options. (2) The header is only emitted when ExecutionDetails.ExecutionTimeMs > 0. The EF Core extensions populate the value automatically; if you build a PagedResult<T> by hand and never call SetExecutionTimeMs, the value stays -1 and the header is skipped.
Microsoft.AspNetCore.Http.IResult (minimal API) collides with RzR.ResultMessage.Abstractions.IResult (returned by the paged helpers). Add a using alias at the top of the file:
using LibResult = RzR.ResultMessage.Abstractions.IResult;C# using aliases do not apply to closed generic types — for IResult<T> use the fully-qualified name RzR.ResultMessage.Abstractions.IResult<T>.
Cast the list to IQueryable<T> and call the Common builders directly, then slice manually. The PagedListResult package depends on EF Core's ToListAsync, so it is not the right tool for in-memory data:
var query = items.AsQueryable();
var rowCount = query.Count();
var slice = query
.OrderBy(x => x.Id)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();If you need the same envelope shape, build a PagedResult<T> manually with the page math.
PagedListResult is maintained by RzR. GitHub repository.
Start here
Reference
- Data Models Reference
- Expression Builders (Common)
- EntityFramework Core Extensions
- Query String Syntax
ASP.NET Core integration
- Web Integration Overview
- MVC Integration
- Minimal API Integration
- Configuration and Options
- Allow List Registry
- Response Headers and ProblemDetails
- OpenAPI and ApiExplorer
Operations