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
Hi I am trying to experiment something for this i am trying to
change a value on the user context from within FieldMiddleware (tried ValidationRule as well).
But the changed value is not available inside the resolver.
I have prepared a small sample project to demonstrate the problem.
Startup class
GraphQlController - I am setting the _fooService on the userContext. From within the fieldmiddleware, I want to update the two properties of the fooService.
var executionOptions = new ExecutionOptions
{
Schema = _schema,
Query = param.Query,
Inputs = inputs,
UserContext = _fooService,
};
FieldsMiddlewareTest
public Task<object> Resolve(
ResolveFieldContext context,
FieldMiddlewareDelegate next)
{
var fooService = (IFooService)context.UserContext;
if (fooService != null)
{
fooService.GivenName = "InstrumentFieldsMiddleware-GivenName";
fooService.FamimlyName = "InstrumentFieldsMiddleware-FamilyName";
}
return next(context);
}
GraphQlQuery - Inside my resolver. I am trying to use the values that I have updated in the fieldmiddleware. But the value FamimlyName and givenName remain null. For some reason the middleware changes are not available in the resolver.
public class GraphQlQuery : ObjectGraphType
{
public GraphQlQuery(IFooService fooService)
{
Field<UserType>("users",
resolve: context =>
{
return new User() { FamilyName = fooService.FamimlyName??"QueryFamilyName", GivenName = fooService.GivenName??"QueryGivenName" };
});
}
}
The text was updated successfully, but these errors were encountered:
Hi I am trying to experiment something for this i am trying to
change a value on the user context from within FieldMiddleware (tried ValidationRule as well).
But the changed value is not available inside the resolver.
I have prepared a small sample project to demonstrate the problem.
Startup class
GraphQlController - I am setting the _fooService on the userContext. From within the fieldmiddleware, I want to update the two properties of the fooService.
FieldsMiddlewareTest
GraphQlQuery - Inside my resolver. I am trying to use the values that I have updated in the fieldmiddleware. But the value FamimlyName and givenName remain null. For some reason the middleware changes are not available in the resolver.
The text was updated successfully, but these errors were encountered: