Show / Hide Table of Contents

Class ApiContext<TModel, TUser>

Context for an API request

Inheritance
Object
ApiContext<TModel, TUser>
Implements
IDisposable
IApiContext<TModel, TUser>
Namespace: Seltzr.Context
Assembly: Seltzr.dll
Syntax
C#
public class ApiContext<TModel, TUser> : IDisposable, IApiContext<TModel, TUser> where TModel : class where TUser : class
Type Parameters
TModel

The type of model being managed by the AP

TUser

The type of authenticated user context

Constructors

| Improve this Doc View Source

ApiContext(HttpContext, Response<TModel>)

Initializes a new instance of the ApiContext<TModel, TUser> class.

C#
public ApiContext(HttpContext httpContext, Response<TModel> response)
Parameters
httpContextHttpContext

The current HttpContext for this request

responseResponse<TModel>

The response for this API call

Properties

| Improve this Doc View Source

HttpContext

Gets the current HttpContext for this request

C#
public virtual HttpContext HttpContext { get; }
Property Value
HttpContext
| Improve this Doc View Source

HttpResponse

Gets the current HTTP response context. Shortcut to Response

C#
public virtual HttpResponse HttpResponse { get; }
Property Value
HttpResponse
| Improve this Doc View Source

Parsed

Gets the models that have been parsed by the body parser. This may be null if the body has not been parsed yet or there are no body parsers registered for this route.

C#
public virtual ParseResult<TModel>[] Parsed { get; }
Property Value
ParseResult<TModel>[]
| Improve this Doc View Source

Request

Gets the current request context. Shortcut to Request

C#
public virtual HttpRequest Request { get; }
Property Value
HttpRequest
| Improve this Doc View Source

Response

Gets the response for this API call. If this is null, the model itself will be serialized instead.

C#
public virtual Response<TModel> Response { get; }
Property Value
Response<TModel>
| Improve this Doc View Source

Services

Gets a service provider for this API context

C#
public virtual IServiceProvider Services { get; }
Property Value
IServiceProvider
| Improve this Doc View Source

User

Gets the authenticated user context for this route. This may be null if authorization has not yet occurred or there are no auth providers registered for this route.

C#
public virtual TUser User { get; }
Property Value
TUser

Methods

| Improve this Doc View Source

Dispose()

Disposes the ApiContext<TModel, TUser>

C#
public void Dispose()

Implements

System.IDisposable
IApiContext<TModel, TUser>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX