Skip to content

Available Dependencies

simonthorogood edited this page Dec 14, 2010 · 4 revisions

By default, OpenRasta registers some useful implementations of services for you which you can access by simply adding a parameter of the correct service type to any constructor in any OpenRasta object, be that a pipeline contributor, a URI decorator, a codec or a simple handler. These services are exposed through the OpenRasta.Web namespace.

Here’s a handy table of some of the most useful singletons/per-request services you can request in your constructors:

Service Description
ICommunicationContext The OpenRasta “God object”, similar in nature to ASP.NET’s HttpContext. Accrues useful information through the lifetime of a request.Try to find another, more specific available interface before using this – it has the same level of mutable state as the aforementioned HttpContext!
IRequest Roughly similar to ASP.NET’s HttpRequest (usually seen on HttpContext.Current.Request). Allows access to the request message, containing query string, URI and so forth
IResponse Contains all data related to the response being sent back to the client. Roughly similar to ASP.NET’s HttpResponse.
IHost Host-specific detail – application’s virtual path
ILogger and ILogger<TLogSource> Provides access to the logging infrastructure
IMetaModelRepository Contains a full MetaModelRepository, which allows you to reason about the relationships between things like handlers, resources, codecs and URIs
IUriResolver Allows resolution of URIs to ResourceMatch instances and allows manual creation of URIs in code
IHandlerRepository Single repository of all registered handler
ICodecRepository Single repository of all registered codecs
Clone this wiki locally