-
-
Save tugberkugurlu/3848310 to your computer and use it in GitHub Desktop.
Injecting HttpRequestMessage in ASP.NET Web API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IHttpController Create( | |
HttpRequestMessage request, | |
HttpControllerDescriptor controllerDescriptor, | |
Type controllerType) | |
{ | |
var scope = request.GetDependencyScope() as StructureMapDependencyScope; | |
// Inject the current request into the underlying container | |
scope.Container.Inject<HttpRequestMessage>(request); | |
return scope.GetService(controllerType) as IHttpController; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment