Show / Hide Table of Contents

Interface IApiContext<TModel, TUser>

Context for an API request.

Namespace: Seltzr.Context
Assembly: Seltzr.dll
Syntax
C#
public interface IApiContext<TModel, out 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

Remarks

The API Context lives for the duration of a single route execution and contains a number of useful properties which are passed to many steps of the request flow. The API Context provides access to the parsed request body, the response wrapper, and a scoped service provider to Auth Providers, Conditions, Filters, Model Providers, Operations, Parsers, and Result Writers.

Properties

| Improve this Doc View Source

HttpContext

Gets the current HttpContext for this request

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

HttpResponse

Gets the current HTTP response context. Shortcut to Response

C#
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#
ParseResult<TModel>[] Parsed { get; }
Property Value
ParseResult<TModel>[]
| Improve this Doc View Source

Request

Gets the current request context. Shortcut to Request

C#
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#
Response<TModel> Response { get; }
Property Value
Response<TModel>
| Improve this Doc View Source

Services

Gets a service provider for this API context

C#
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#
TUser User { get; }
Property Value
TUser
  • Improve this Doc
  • View Source
Back to top Generated by DocFX