From aee7973c1166e5a58c218f0fe57f7e47194ff2f1 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 4 May 2016 08:31:21 +0200 Subject: [PATCH] IScopeContextAdapter uses LogicalCallContext --- .../DefaultScopeContextAdapter.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Core/DefaultScopeContextAdapter.cs b/src/Umbraco.Core/DefaultScopeContextAdapter.cs index e584f1a6c0..c9bdd75c8a 100644 --- a/src/Umbraco.Core/DefaultScopeContextAdapter.cs +++ b/src/Umbraco.Core/DefaultScopeContextAdapter.cs @@ -5,26 +5,17 @@ namespace Umbraco.Core { internal class DefaultScopeContextAdapter : IScopeContextAdapter { - - // some reading: - // fixme: do we need to keep these links? - // https://github.com/seesharper/LightInject/issues/170 - // http://stackoverflow.com/questions/22924048/is-it-possible-to-detect-if-you-are-on-the-synchronous-side-of-an-async-method - // http://stackoverflow.com/questions/29917671/lightinject-with-web-api-how-can-i-get-the-httprequestmessage - // http://stackoverflow.com/questions/18459916/httpcontext-current-items-after-an-async-operation - // http://stackoverflow.com/questions/12029091/httpcontext-is-null-after-await-task-factory-fromasyncbeginxxx-endxxx - // - // also note + // note // CallContext stuff will flow downwards in async but not upwards ie an async call will receive the values // but any changes it makes will *not* modify the caller's CallContext, so we should be careful when using // this for caches and stuff - - // fixme - should we use the LogicalCallContext here? + // + // also might have to look for another solution for .NET Core as CallContext prob won't be available. public object Get(string key) { return HttpContext.Current == null - ? CallContext.GetData(key) + ? CallContext.LogicalGetData(key) : HttpContext.Current.Items[key]; } @@ -33,7 +24,7 @@ namespace Umbraco.Core if (HttpContext.Current == null) { if (value != null) - CallContext.SetData(key, value); + CallContext.LogicalSetData(key, value); else CallContext.FreeNamedDataSlot(key); }