Skip to content

Instantly share code, notes, and snippets.

@tomachristian
Created October 21, 2024 08:35
Show Gist options
  • Save tomachristian/c523f8d196b76edc4924f8235543f889 to your computer and use it in GitHub Desktop.
Save tomachristian/c523f8d196b76edc4924f8235543f889 to your computer and use it in GitHub Desktop.
[NodeResolver]
public static Task<Entity?> Get(
Id id,
IResolverContext resolver,
IEntityByIdDataLoader entityById,
CancellationToken cancellationToken)
{
// Invoked twice during the same request
}
[DataLoader]
public static async Task<Dictionary<Guid, Entity>> GetEntityById(
IReadOnlyList<Guid> ids,
ScopedDbContext db,
CancellationToken cancellationToken)
{
// Should be invoked once, but actually invoked twice; yields to SQL queries instead of one
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment