Rename IHttpContextAccessor.Value to IHttpContextAccessor.HttpContext
Fixes: https://github.com/aspnet/Hosting/issues/160
This commit is contained in:
parent
16c8d51d0b
commit
d6535eeba0
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Hosting
|
|||
#if ASPNET50
|
||||
private const string LogicalDataKey = "__HttpContext_Current__";
|
||||
|
||||
public HttpContext Value
|
||||
public HttpContext HttpContext
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Hosting
|
|||
|
||||
#elif ASPNETCORE50
|
||||
private AsyncLocal<HttpContext> _httpContextCurrent = new AsyncLocal<HttpContext>();
|
||||
public HttpContext Value
|
||||
public HttpContext HttpContext
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ namespace Microsoft.AspNet.Hosting
|
|||
{
|
||||
public interface IHttpContextAccessor
|
||||
{
|
||||
HttpContext Value { get; set; }
|
||||
HttpContext HttpContext { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Hosting.Internal
|
|||
public Task Invoke(IFeatureCollection featureCollection)
|
||||
{
|
||||
var httpContext = _httpContextFactory.CreateHttpContext(featureCollection);
|
||||
_contextAccessor.Value = httpContext;
|
||||
_contextAccessor.HttpContext = httpContext;
|
||||
return _requestDelegate(httpContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.TestHost
|
|||
app.Run(context =>
|
||||
{
|
||||
var accessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
|
||||
return context.Response.WriteAsync("HasContext:"+(accessor.Value != null));
|
||||
return context.Response.WriteAsync("HasContext:"+(accessor.HttpContext != null));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue