The N+1 Problem
If you have a resolver for a child property, it might execute one query for every parent record.
The Solution: Batching
DataLoaders collect IDs and fetch them in a single batch.
public class ProductByIdDataLoader : BatchDataLoader<int, Product>
{
protected override async Task<IReadOnlyDictionary<int, Product>> LoadBatchAsync(...)
{
return await db.Products.Where(p => keys.Contains(p.Id)).ToDictionaryAsync(...);
}
}