Provides Context management for ASP.NET applications.
For a list of all members of this type, see GenomeContextHttpModule Members.
System.Object
GenomeContextHttpModule
This module is designed to maintain Context instances of different level that can be usefull in ASP.NET Web applications.
The module changes the context stack from being thread-affine to request-affine registering an IContextStackBinder implementation that stores and retrieves the context stack in/from the current HTTP request. When storing the stack in a thread-local variable it can be "lost" during the execution of the request handler. Fireing several requests from the same session makes the later requests waiting on a session lock until the previous request is served, and if thread-pooling is enabled it is possible that the suspended request execution is continued on a different thread. Storing the context stack on the request ensures that it is available during the lifetime of the request.
The module creates a request Context that is bound to the HTTP request. At the beginning of the request the CreateRequestContext event is triggered allowing the creation of the new Context instance. If no Context is provided by the event handler a new LocalContext is created. The new Context is pushed on the top of the context stack immediatelly. At the end of the HTTP request the Context is popped from the stack and it is destroyed calling Context.Dispose on it. In the end the stack is monitored searching for remaining Context instances: if the stack is not empty a WebExtensionException is thrown.
Currently we provide automatic support for request contexts only.
To use the module you have to register it as an IHttpModule in the web.config file of your web application.
<system.web>
...
<httpModules>
...
<add type="TechTalk.Genome.Extensions.Web.GenomeContextHttpModule, TechTalk.Genome.Extensions.Web"
name="GenomeContextHttpModule" />
</httpModules>
</system.web>Namespace: TechTalk.Genome.Extensions.Web
Assembly: TechTalk.Genome.Extensions.Web (in TechTalk.Genome.Extensions.Web.dll)
Version: 4.2.4.4
Editions: Professional, Evaluation, Express
GenomeContextHttpModule Members | TechTalk.Genome.Extensions.Web Namespace