Fixing that the new HttpAsyncHandler didn't expose the RequestContext, causing injected RequestContext objects to be empty

This commit is contained in:
Lombiq
2015-01-12 18:22:06 +01:00
committed by Zoltán Lehóczky
parent 94cdaa3d74
commit 4cb06abd2a

View File

@@ -145,7 +145,7 @@ namespace Orchard.Mvc.Routes {
}
}
class HttpAsyncHandler : HttpTaskAsyncHandler, IRequiresSessionState {
class HttpAsyncHandler : HttpTaskAsyncHandler, IRequiresSessionState, IHasRequestContext {
private readonly IWorkContextAccessor _workContextAccessor;
private readonly IHttpAsyncHandler _httpAsyncHandler;
private readonly Func<IDictionary<string, object>, Task> _pipeline;
@@ -181,6 +181,13 @@ namespace Orchard.Mvc.Routes {
await _pipeline.Invoke(environment);
}
}
public RequestContext RequestContext {
get {
var mvcHandler = _httpAsyncHandler as MvcHandler;
return mvcHandler == null ? null : mvcHandler.RequestContext;
}
}
}
}
}