private ExecutionContextStorage GetCurrentContextInternal() { if (IsDisposed) { return(ExecutionContextStorage.GetEmptyContext()); } return(_noFlowContext.Value ?? _executionContextStore.Value); }
public Guid SetAndGetContextElement(Guid contextTypeGuid, Guid contextElement) { if (IsDisposed) { return(Guid.Empty); } var storage1 = GetCurrentContextInternal() ?? ExecutionContextStorage.GetEmptyContext(); var storage2 = storage1.UpdateElement(contextTypeGuid, contextElement, out var previeousValue); _executionContextStore.Value = storage2.IsEmpty ? null : storage2; _noFlowContext.Value = null; return(previeousValue); }