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:
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user