Retrieves the HttpRequestMessage instance for the current request.
Namespace: SimpleInjector
Assembly: SimpleInjector.Integration.WebApi (in SimpleInjector.Integration.WebApi.dll) Version: 5.3.0
Syntax
public static HttpRequestMessage GetCurrentHttpRequestMessage( this Container container )
Parameters
- container
- Type: SimpleInjectorContainer
The container.
Return Value
Type: HttpRequestMessageThe HttpRequestMessage for the current request.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Container. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Thrown when this method is called before EnableHttpRequestMessageTracking(Container, HttpConfiguration) is called. |
ArgumentNullException | Thrown when the container argument is a null reference. |
See Also