Skip to content

Context Injection Query For Async ReqNroll #481

Answered by Code-Grump
ChrisTyler-6788 asked this question in Q&A
Discussion options

You must be logged in to vote

As you have already surmised, the ideal solution here is to not couple your objects to threads or execution flows and instead lean on the DI system to provide these components to your other objects where they need them: it's precisely what the DI system is for.

You might be able to get something to work quickly by using AsyncLocal to flow values along the execution paths, but there are strict limitations to the direction of information flow and I cannot suggest it's a good long-term position for precisely the kind of problems you've encountered.

If there's something about using the DI system that's not working for you, or if you'd like to run through some examples of what you believe you'…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by 304NotModified
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@gasparnagy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants