Scoped Service in FilterFieldHandler #3305
gojanpaolo
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I just want to share a way to access a scoped service in a custom
FilterFieldHandler
implementation. Essentially, the key is the use ofIHttpContextAccessor
.In this example,
BarService
is registered as a scoped service.FooBarFieldHandler
is then injected withIHttpContextAccessor
and then gets theBarService
instance from it as shown inTryHandleEnter
.Sample GraphQL query
Beta Was this translation helpful? Give feedback.
All reactions