Rename IHttpContextAccessor.Value to IHttpContextAccessor.HttpContext

Fixes: https://github.com/aspnet/Hosting/issues/160
This commit is contained in:
Praburaj 2015-03-02 10:38:37 -08:00
parent 16c8d51d0b
commit d6535eeba0
4 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Hosting
#if ASPNET50 #if ASPNET50
private const string LogicalDataKey = "__HttpContext_Current__"; private const string LogicalDataKey = "__HttpContext_Current__";
public HttpContext Value public HttpContext HttpContext
{ {
get get
{ {
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Hosting
#elif ASPNETCORE50 #elif ASPNETCORE50
private AsyncLocal<HttpContext> _httpContextCurrent = new AsyncLocal<HttpContext>(); private AsyncLocal<HttpContext> _httpContextCurrent = new AsyncLocal<HttpContext>();
public HttpContext Value public HttpContext HttpContext
{ {
get get
{ {

View File

@ -7,6 +7,6 @@ namespace Microsoft.AspNet.Hosting
{ {
public interface IHttpContextAccessor public interface IHttpContextAccessor
{ {
HttpContext Value { get; set; } HttpContext HttpContext { get; set; }
} }
} }

View File

@ -25,7 +25,7 @@ namespace Microsoft.AspNet.Hosting.Internal
public Task Invoke(IFeatureCollection featureCollection) public Task Invoke(IFeatureCollection featureCollection)
{ {
var httpContext = _httpContextFactory.CreateHttpContext(featureCollection); var httpContext = _httpContextFactory.CreateHttpContext(featureCollection);
_contextAccessor.Value = httpContext; _contextAccessor.HttpContext = httpContext;
return _requestDelegate(httpContext); return _requestDelegate(httpContext);
} }

View File

@ -46,7 +46,7 @@ namespace Microsoft.AspNet.TestHost
app.Run(context => app.Run(context =>
{ {
var accessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>(); var accessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
return context.Response.WriteAsync("HasContext:"+(accessor.Value != null)); return context.Response.WriteAsync("HasContext:"+(accessor.HttpContext != null));
}); });
}); });