AutofacWebTypesModule Class |
Namespace: Autofac.Integration.Mvc
The AutofacWebTypesModule type exposes the following members.
| Name | Description | |
|---|---|---|
| AutofacWebTypesModule | Initializes a new instance of the AutofacWebTypesModule class |
| Name | Description | |
|---|---|---|
| ThisAssembly |
Gets the assembly in which the concrete module type is located. To avoid bugs whereby deriving from a module will
change the target assembly, this property can only be used by modules that inherit directly from
Module.
(Inherited from Module.) |
| Name | Description | |
|---|---|---|
| AttachToComponentRegistration |
Override to attach module-specific functionality to a
component registration.
(Inherited from Module.) | |
| AttachToRegistrationSource |
Override to perform module-specific processing on a registration source.
(Inherited from Module.) | |
| Configure |
Apply the module to the component registry.
(Inherited from Module.) | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| Load |
Registers web abstractions with dependency injection.
(Overrides ModuleLoad(ContainerBuilder).) | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
This Module is primarily used during application startup (in Global.asax) to register mappings from commonly referenced contextual application properties to their corresponding abstraction.
The following mappings are made:
| Common Construct | Abstraction |
|---|---|
| HttpContext.Current | HttpContextBase |
| HttpContext.Current.Application | HttpApplicationStateBase |
| HttpContext.Current.Request | HttpRequestBase |
| HttpContext.Current.Request.Browser | HttpBrowserCapabilitiesBase |
| HttpContext.Current.Request.Files | HttpFileCollectionBase |
| HttpContext.Current.Request.RequestContext | RequestContext |
| HttpContext.Current.Response | HttpResponseBase |
| HttpContext.Current.Response.Cache | HttpCachePolicyBase |
| HttpContext.Current.Server | HttpServerUtilityBase |
| HttpContext.Current.Session | HttpSessionStateBase |
| HostingEnvironment.VirtualPathProvider | VirtualPathProvider |
In addition, the UrlHelper type is registered for construction based on the current RequestContext.
The lifetime for each of these items is one web request.