We are on HC v12 and need to override the default MaxBatchSize of data loaders (it defaults to 1024 despite the docs saying it defaults to unlimited). Specifically we need an unlimited (or very high) batch size.
The sample custom data loader in the docs is injected via param injection, but we use code-first resolvers like:
descriptor.Field("myField")
.Type<BooleanType>()
.Argument(
"projectId",
a => a
.Type<StringType>()
.Description("The ID of the current project"))
.Resolve(async context =>
{
// resolver code here
});
There doesn't seem to be a way to configure the data loader using the inline context.BatchDataLoader, so we thought to use a custom data loader class, but that class requires context-specific constructor params and is intended to be auto-injected. We use code-first resolvers so this isn't an option for us. Sample data loader from the docs:
public PersonBatchDataLoader(
IPersonRepository repository,
IBatchScheduler batchScheduler,
DataLoaderOptions<string>? options = null)
: base(batchScheduler, options)
{
_repository = repository;
}
So how can we use, say, an instance of PersonBatchDataLoader inside our Resolve method? It no longer seems possible to grab it via context.DataLoader as in this older issue.