Wires up DI for cross wiring correctly ensuring that it occurs at the very end of ConfigureServices, updates tests accordingly, fixes a few other things.

This commit is contained in:
Shannon
2020-03-13 18:44:58 +11:00
parent c9913f45a0
commit 9ded4c7ddb
13 changed files with 264 additions and 41 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Umbraco.Net;
namespace Umbraco.Web.BackOffice.AspNetCore
@@ -12,6 +13,17 @@ namespace Umbraco.Web.BackOffice.AspNetCore
_httpContextAccessor = httpContextAccessor;
}
public string SessionId => _httpContextAccessor?.HttpContext.Session?.Id;
public string SessionId
{
get
{
// If session isn't enabled this will throw an exception so we check
var sessionFeature = _httpContextAccessor?.HttpContext?.Features.Get<ISessionFeature>();
return sessionFeature != null
? _httpContextAccessor?.HttpContext?.Session?.Id
: "0";
}
}
}
}