Skip to content

Add PagingQueryableExtensions for Marten #8251

@s3w3nofficial

Description

@s3w3nofficial

Product

Green Donut

Is your feature request related to a problem?

Currently there is no support for ToPageAsync extension method's when using Hotchocolate.Data.Marten.

Existing EntityFrameworkCore version

public class GetBrandQueryHandler(CatalogContext context)
    : IRequestHandler<GetBrandsQuery, Page<Brand>>
{
    public async Task<Page<Brand>> Handle(
        GetBrandsQuery request,
        CancellationToken cancellationToken)
        => await context.Brands
            .With(request.Query, s => s.AddAscending(t => t.Id))
            .ToPageAsync(request.PagingArguments, cancellationToken);
}

The solution you'd like

I would like to implement it so that it has the same signature as Hotchocolate.Data.EntityFrameworkCore.

Marten (not implemented)

public class GetBrandQueryHandler(IDocumentSession session)
    : IRequestHandler<GetBrandsQuery, Page<Brand>>
{
    public async Task<Page<Brand>> Handle(
        GetBrandsQuery request,
        CancellationToken cancellationToken)
        => await session.Query<Brand>()
            .With(request.Query, s => s.AddAscending(t => t.Id))
            .ToPageAsync(request.PagingArguments, cancellationToken);
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions