diff --git a/src/Microsoft.AspNet.Mvc.Core/PhysicalFileProviderResult.cs b/src/Microsoft.AspNet.Mvc.Core/PhysicalFileProviderResult.cs index 224758a97c..0f739898e3 100644 --- a/src/Microsoft.AspNet.Mvc.Core/PhysicalFileProviderResult.cs +++ b/src/Microsoft.AspNet.Mvc.Core/PhysicalFileProviderResult.cs @@ -69,7 +69,7 @@ namespace Microsoft.AspNet.Mvc throw new FileNotFoundException(Resources.FormatFileResult_InvalidPath(FileName), FileName); } - var sendFile = response.HttpContext.GetFeature(); + var sendFile = response.HttpContext.Features.Get(); if (sendFile != null) { await sendFile.SendFileAsync( diff --git a/src/Microsoft.AspNet.Mvc.Core/VirtualFileProviderResult.cs b/src/Microsoft.AspNet.Mvc.Core/VirtualFileProviderResult.cs index c2cccd6e8a..ffe39b03aa 100644 --- a/src/Microsoft.AspNet.Mvc.Core/VirtualFileProviderResult.cs +++ b/src/Microsoft.AspNet.Mvc.Core/VirtualFileProviderResult.cs @@ -86,7 +86,7 @@ namespace Microsoft.AspNet.Mvc if (fileInfo.Exists) { var physicalPath = fileInfo.PhysicalPath; - var sendFile = response.HttpContext.GetFeature(); + var sendFile = response.HttpContext.Features.Get(); if (sendFile != null && !string.IsNullOrEmpty(physicalPath)) { await sendFile.SendFileAsync( diff --git a/src/Microsoft.AspNet.Mvc.Razor/RazorView.cs b/src/Microsoft.AspNet.Mvc.Razor/RazorView.cs index 8c271c4f28..1353ccdece 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/RazorView.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/RazorView.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.AspNet.PageExecutionInstrumentation; using Microsoft.Framework.Internal; @@ -68,7 +69,7 @@ namespace Microsoft.AspNet.Mvc.Razor /// public virtual async Task RenderAsync([NotNull] ViewContext context) { - _pageExecutionFeature = context.HttpContext.GetFeature(); + _pageExecutionFeature = context.HttpContext.Features.Get(); // Partials don't execute _ViewStart pages, but may execute Layout pages if the Layout property // is explicitly specified in the page. diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/SkipStatusCodePagesAttribute.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/SkipStatusCodePagesAttribute.cs index 84e8f26fe0..49b741fd09 100644 --- a/src/Microsoft.AspNet.Mvc.ViewFeatures/SkipStatusCodePagesAttribute.cs +++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/SkipStatusCodePagesAttribute.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Http.Features; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc @@ -21,7 +22,7 @@ namespace Microsoft.AspNet.Mvc /// public void OnResourceExecuting([NotNull]ResourceExecutingContext context) { - var statusCodeFeature = context.HttpContext.GetFeature(); + var statusCodeFeature = context.HttpContext.Features.Get(); if (statusCodeFeature != null) { // Turn off the StatusCodePages feature. diff --git a/src/Microsoft.AspNet.Mvc.ViewFeatures/TempData/SessionStateTempDataProvider.cs b/src/Microsoft.AspNet.Mvc.ViewFeatures/TempData/SessionStateTempDataProvider.cs index eab56d2b4f..7eabbe2c8d 100644 --- a/src/Microsoft.AspNet.Mvc.ViewFeatures/TempData/SessionStateTempDataProvider.cs +++ b/src/Microsoft.AspNet.Mvc.ViewFeatures/TempData/SessionStateTempDataProvider.cs @@ -183,7 +183,7 @@ namespace Microsoft.AspNet.Mvc private static bool IsSessionEnabled(HttpContext context) { - return context.GetFeature() != null; + return context.Features.Get() != null; } internal void EnsureObjectCanBeSerialized(object item) diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs index 161207ff5c..c43cdbd6eb 100644 --- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs +++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Formatters/HttpResponseMessageOutputFormatter.cs @@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim { response.StatusCode = (int)responseMessage.StatusCode; - var responseFeature = context.HttpContext.GetFeature(); + var responseFeature = context.HttpContext.Features.Get(); if (responseFeature != null) { responseFeature.ReasonPhrase = responseMessage.ReasonPhrase; diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs index f28bec4d50..23bae41498 100644 --- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs +++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/HttpRequestMessage/HttpRequestMessageHttpContextExtensions.cs @@ -3,6 +3,7 @@ using System.Net.Http; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; namespace Microsoft.AspNet.Mvc.WebApiCompatShim { @@ -10,11 +11,11 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim { public static HttpRequestMessage GetHttpRequestMessage(this HttpContext httpContext) { - var feature = httpContext.GetFeature(); + var feature = httpContext.Features.Get(); if (feature == null) { feature = new HttpRequestMessageFeature(httpContext); - httpContext.SetFeature(feature); + httpContext.Features.Set(feature); } return feature.HttpRequestMessage; diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/PhysicalFileProviderResultTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/PhysicalFileProviderResultTest.cs index 1451468bd5..ff74a194f0 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/PhysicalFileProviderResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/PhysicalFileProviderResultTest.cs @@ -61,7 +61,7 @@ namespace Microsoft.AspNet.Mvc .Returns(Task.FromResult(0)); var httpContext = new DefaultHttpContext(); - httpContext.SetFeature(sendFileMock.Object); + httpContext.Features.Set(sendFileMock.Object); var context = new ActionContext(httpContext, new RouteData(), new ActionDescriptor()); // Act diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/VirtualFileProviderResultTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/VirtualFileProviderResultTest.cs index 5f5f58b20b..f9bf7ccb52 100644 --- a/test/Microsoft.AspNet.Mvc.Core.Test/VirtualFileProviderResultTest.cs +++ b/test/Microsoft.AspNet.Mvc.Core.Test/VirtualFileProviderResultTest.cs @@ -100,7 +100,7 @@ namespace Microsoft.AspNet.Mvc .Returns(Task.FromResult(0)); var httpContext = new DefaultHttpContext(); - httpContext.SetFeature(sendFileMock.Object); + httpContext.Features.Set(sendFileMock.Object); var context = new ActionContext(httpContext, new RouteData(), new ActionDescriptor()); // Act diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorViewTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorViewTest.cs index 713cd3eef8..e458c124d1 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorViewTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorViewTest.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Mvc.ModelBinding; using Microsoft.AspNet.PageExecutionInstrumentation; @@ -1096,7 +1097,7 @@ namespace Microsoft.AspNet.Mvc.Razor page, isPartial: false); var viewContext = CreateViewContext(view); - viewContext.HttpContext.SetFeature(feature.Object); + viewContext.HttpContext.Features.Set(feature.Object); // Act await view.RenderAsync(viewContext); @@ -1142,7 +1143,7 @@ namespace Microsoft.AspNet.Mvc.Razor isPartial: true); var viewContext = CreateViewContext(view); viewContext.Writer = writer; - viewContext.HttpContext.SetFeature(feature.Object); + viewContext.HttpContext.Features.Set(feature.Object); // Act await view.RenderAsync(viewContext); diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/SkipStatusCodePagesAttributeTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/SkipStatusCodePagesAttributeTest.cs index 91f4affa8a..0afb403ec7 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/SkipStatusCodePagesAttributeTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/SkipStatusCodePagesAttributeTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Internal; using Microsoft.AspNet.Routing; using Xunit; @@ -17,7 +18,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test var skipStatusCodeAttribute = new SkipStatusCodePagesAttribute(); var resourceExecutingContext = CreateResourceExecutingContext(new IFilterMetadata[] { skipStatusCodeAttribute }); var statusCodePagesFeature = new TestStatusCodeFeature(); - resourceExecutingContext.HttpContext.SetFeature(statusCodePagesFeature); + resourceExecutingContext.HttpContext.Features.Set(statusCodePagesFeature); // Act skipStatusCodeAttribute.OnResourceExecuting(resourceExecutingContext); diff --git a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/TempData/SessionStateTempDataProviderTest.cs b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/TempData/SessionStateTempDataProviderTest.cs index adea9d5826..2a498f1e73 100644 --- a/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/TempData/SessionStateTempDataProviderTest.cs +++ b/test/Microsoft.AspNet.Mvc.ViewFeatures.Test/TempData/SessionStateTempDataProviderTest.cs @@ -352,7 +352,7 @@ namespace Microsoft.AspNet.Mvc var httpContext = new DefaultHttpContext(); if(sessionEnabled) { - httpContext.SetFeature(new SessionFeature() { Session = session }); + httpContext.Features.Set(new SessionFeature() { Session = session }); } return httpContext; } diff --git a/test/WebSites/FilesWebSite/SendFileMiddleware.cs b/test/WebSites/FilesWebSite/SendFileMiddleware.cs index 8f9c8c7f8e..7831bf02b1 100644 --- a/test/WebSites/FilesWebSite/SendFileMiddleware.cs +++ b/test/WebSites/FilesWebSite/SendFileMiddleware.cs @@ -26,10 +26,10 @@ namespace FilesWebSite { var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment)); - if (context.GetFeature() == null) + if (context.Features.Get() == null) { var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath); - context.SetFeature(sendFile); + context.Features.Set(sendFile); } await _next(context); diff --git a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs index 207d56940b..bd6d7e96d9 100644 --- a/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs +++ b/test/WebSites/RazorPageExecutionInstrumentationWebSite/Startup.cs @@ -5,6 +5,7 @@ using System; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; +using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Mvc.Razor.Compilation; using Microsoft.AspNet.PageExecutionInstrumentation; using Microsoft.Framework.DependencyInjection; @@ -34,7 +35,7 @@ namespace RazorPageExecutionInstrumentationWebSite { var pageExecutionContext = context.ApplicationServices.GetRequiredService(); var listenerFeature = new TestPageExecutionListenerFeature(pageExecutionContext); - context.SetFeature(listenerFeature); + context.Features.Set(listenerFeature); } await next();