You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my codebase, I am already using EntityFramework and setup HotChocolate to use my DBContext. I added Projections so that user don't have to fetch every field in a column when they often may only need a relatively small subset of them.
The problem I'm running into is that I want to add a new field to my object that is calculated by calling out to another service.
Existing Sample
{
ClaimNumber,
ClaimTotal,
OtherFields
}
I want to add a bool isPaid field.
I need to take the ClaimNumber and call out to another service. That service returns a ClaimAmountPaid.
What happens though, is that if the GraphQl query sent into the server does not specifically request the ClaimNumber and the ClaimTotal, then those are "blank (set to 0)". I'm pretty sure this is happening because of the projection, and the projection doesn't realize that I need them for calls within my added field.
Is there a way to do any of the following, or some other options I should consider?
Let the "Parent" field sent into know that it reuires specific fields (some sort of attribute, etc)?
Doesn't have to be via the Parent field, just a starting point
Tell HotChocolate that when I fetch this specific object - I should ALWAYS grab some of the fields no matter what?
That would be better to always have to grab them even when I don't need them. At least in this case it's only 2 more fields, although this gets worse if I need to continue to add more fields.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
In my codebase, I am already using EntityFramework and setup HotChocolate to use my DBContext. I added Projections so that user don't have to fetch every field in a column when they often may only need a relatively small subset of them.
The problem I'm running into is that I want to add a new field to my object that is calculated by calling out to another service.
Existing Sample
I want to add a bool isPaid field.
I need to take the ClaimNumber and call out to another service. That service returns a ClaimAmountPaid.
What happens though, is that if the GraphQl query sent into the server does not specifically request the ClaimNumber and the ClaimTotal, then those are "blank (set to 0)". I'm pretty sure this is happening because of the projection, and the projection doesn't realize that I need them for calls within my added field.
Is there a way to do any of the following, or some other options I should consider?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions