Is it possible to apply middleware to all fields in Query object in HotChocolate in C#?

39 Views Asked by At

The thing is I have to add the same attributes

[UsePaging]
[UseProjection]
[UseFiltering]
[UseSorting]

to all fields in Query object manually. Is there way to apply these middlewares to all fields automaticaly?

People say that it can be done with QueryExecutionBuilder https://chillicream.com/docs/hotchocolate/v10/execution-engine#field-middleware but I don't quite understand how to use it. Thanks!

Something like, without specifying concrete field

public class Query : ObjectType
{
        protected override void Configure(IObjectTypeDescriptor descriptor)
        {
            descriptor
                .UsePaging()
                .UseProjection()
                .UseFiltering()
                .UseSorting();
        }
...
0

There are 0 best solutions below