graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Add PagingQueryableExtensions for Marten

Open s3w3nofficial opened this issue 8 months ago • 0 comments

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);
}

s3w3nofficial avatar Apr 18 '25 03:04 s3w3nofficial