Update:
Found similar question.
I want to implement some services following AmbientContext design pattern for our ASP.NET application.
For example I need user name (like Thread.CurrentPrincipal) to be set once at the very beginning of the request processing and flow between threads when async operations are performed.
Thus I need to attach data to ExecutionContext and then detach it when request is processed.
Unfortuantely, I have no idea, how to do it.
There is only a small hint in documentation:
Internally, the ExecutionContext stores all data that is associated with the LogicalCallContext. This allows the LogicalCallContext data to be propagated when the ExecutionContext is copied and transferred.