I've this scenario, wanted to check if is feasible before going that route.
I've a webApi project, there is a delegateHandler which adds some data in HttpContext.Current.Items. In controller there are few async calls which I'm doing with configureawait(false). Same in the library DLL.
Overall code looks like this.....
In controller
public async Task<Entity> func()
{
HttpContext.Current.Items.Add(key, value);
await DBCalls.Method1Async().configureawait(false);
await DBCalls.Method2Async().configureawait(false);
var data = HttpContext.Current.Items[key];
// rest of the method
}
In DLL, class DBCalls
async void Method1Async()
{
await internalMethod1().configureawait(false)
}
async void Method2Async()
{
await internalMethod2().configureawait(false)
}
Question is when execution resumes back on controller function will I get stored data back from HttpContext.Current.Items?