Namespace: ITHit.Server
public abstract class ContextAsync<THierarchyItem> where THierarchyItem : IHierarchyItemBase
The ContextAsyncTHierarchyItem type exposes the following members.
Name | Description | |
---|---|---|
ContextAsyncTHierarchyItem |
Initializes a new instance of the context. Initializes RequestAsync and ResponseAsync properties.
|
Name | Description | |
---|---|---|
Engine |
Instance of Engine which is currently executing the request.
| |
Exception |
Exception which occurred during request execution.
| |
Request |
Object representing current request.
| |
Response |
Object representing current response.
|
Name | Description | |
---|---|---|
BeforeResponseAsync |
This method is called right before engine starts writing response.
| |
EnsureBeforeResponseWasCalledAsync |
Calls BeforeResponseAsync only first time this method is invoked.
| |
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.) | |
GetHierarchyItemAsync |
Implementation of this abstract method is used by the engine to find hierarchy item objects by path.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
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 class provides the engine with information about currently executing context. It holds request, response and provides item factory method GetHierarchyItemAsync(String) to resolve items by path.
The library provides a set of context classes derived from this class, that provide constructors for .NET Core, ASP.NET, HttpLitener and other environments. Typically you will not derive your class directly from this class. Instead, you will derive your class from one of the context classes designed for your environment, such as ContextCoreAsyncTHierarchyItemAsync, ContextWebAsyncTHierarchyItem, etc.
When inheriting you must implement the GetHierarchyItemAsync(String) method. In this method, you will search for items (files, folders, versions, etc.) in your storage by path provided and return it to the engine.
In each HTTP request you will create a separate instance of your class and pass it to RunAsync(ContextAsyncTHierarchyItemAsync) method.
You can implement your own request and response classes to run the engine in virtually any hosting environment.