Implement WorkContent.HttpContext

Work Item: 17008

--HG--
branch : 1.x
This commit is contained in:
Renaud Paquay
2011-01-11 11:37:50 -08:00
parent c731c2b591
commit 8277e19312
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using System;
namespace Orchard.Mvc {
public class HttpContextWorkContext : IWorkContextStateProvider {
private readonly IHttpContextAccessor _httpContextAccessor;
public HttpContextWorkContext(IHttpContextAccessor httpContextAccessor) {
_httpContextAccessor = httpContextAccessor;
}
public Func<WorkContext, T> Get<T>(string name) {
if (name == "HttpContext") {
var result = (T)(object)_httpContextAccessor.Current();
return ctx => result;
}
return null;
}
}
}

View File

@@ -183,6 +183,7 @@
<Compile Include="Localization\Services\ILocalizedStringManager.cs" />
<Compile Include="Logging\OrchardFileAppender.cs" />
<Compile Include="Messaging\Services\DefaultMessageManager.cs" />
<Compile Include="Mvc\HttpContextWorkContext.cs" />
<Compile Include="Mvc\Extensions\ControllerExtensions.cs" />
<Compile Include="Mvc\IOrchardViewPage.cs" />
<Compile Include="Mvc\ShapeResult.cs" />