As a user, I want to scope accross chronicle instances, so that I can use another class that's had one injected without loosing scope
kana-ki opened this issue · 1 comments
kana-ki commented
Going to have to move into ThreadLocals here - this is most robust solution for heavy class calls. However there are some things to note:
- Using the chronicle inside of a nested thread, such as when using
Thread
or TPL, the scope stack will be reset. - If the chronicle instance attempts to cache the scope stack, another classes scope stack will not update it
- It couldn't take the largest scope on get, because parallelism would conflict
kana-ki commented
ChronicleScope is now ThreadLocal based and stacks with each ScopeIn
. Scoping in and out in one chronicle instance will also effect other chronicle instances executed under the same managed thread. By default other threads created by Thread
of TPL will reset back to 0 scope, you can use BeginScope(ChronicleScope)
to restore the scope to previously created scope. Scoping in and out in a thread (regardless of whether a scope was restored or not) will not scope in or out in any other thread.