Skip to content

Add a RelayBatchDataLoader to existing DataLoaders #1690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karrocon
Copy link

PULL REQUEST DESCRIPTION

This is a proposal for a new dataloader based on the Relay specification. The proposed code will be used to ease the development of GraphQL Relay servers by providing the required page information to the resolving (typically infrastructure) layer.

RELATED TOPIC

In my opinion, using EntityFrameworkCore is the most natural way of resolving GraphQL .NET server requests. However, with the current solution, it is quite painful to fetch data from a DataSet with a Relay implementation. To release the stress, I have coded a ToConnectionDictionary method that is an extension of IQueryable with the following heading:

private static async Task<IDictionary<TKey, Connection<T>>> ToConnectionDictionary<T, TKey>(this IQueryable<T> query, IEnumerable<PageRequest<TKey>> pageRequests, Expression<Func<T, TKey>> keySelector, Expression<Func<T, string>> cursorSelector)

This method fits perfectly with the new RelayBatchDataLoader and relieves the pain of correctly coding it.

@Shane32
Copy link
Member

Shane32 commented Aug 7, 2020

I suggest this PR be revised and reviewed after #1511 as the latter PR will slightly change the code in this PR.

@Shane32
Copy link
Member

Shane32 commented Jul 4, 2022

I feel that we should consider moving this functionality to the Relay project. It may not be needed (or be able to be greatly simplified) now that the Relay project supports IQueryable.

@sungam3r
Copy link
Member

sungam3r commented Jul 4, 2022

Also I would like to move relay graph types into relay project.

@sungam3r
Copy link
Member

sungam3r commented Jul 4, 2022

Everything from here
изображение
+ connection builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data loader Relates to GraphQL data loaders
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy