Is there a way to add a dependency for some field?
This example returns null if descriptionLocaleId is not selected in gql query.
descriptor.Field("description").Resolver(ctx => ctx.Parent<Item>().DescriptionLocaleId);
I am using EF Core 5, Hot Chocolate v11 with UseProjectionAttribute
Desired functionality:
descriptor.Field("description").DependsOn(x => x.DescriptionLocaleId).Resolver(ctx => ctx.Parent<Item>().DescriptionLocaleId);
@JakeSmokie
We plan to add resolver metadata to do exactly that
For now you can use the IsProjectedAttribute
[IsProjected(true)]
public string DescriptionLocaleId {get;set;}
or set it via
descriptor.Field(x => x.DescriptionLocaleId).IsProjected(true);
This way this field is always projected and your resolver should work.
Direct resolver dependencies will come in a later release
Most helpful comment
@JakeSmokie
We plan to add resolver metadata to do exactly that
For now you can use the IsProjectedAttribute
or set it via
This way this field is always projected and your resolver should work.
Direct resolver dependencies will come in a later release