Eigenverft.WebLib.Infrastructure
  • Guides
  • API
Show / Hide Table of Contents
  • Eigenverft.WebLib.Infrastructure.Hosting
    • HttpResponseExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Configuration.Values
    • AspNetDataProtectionConfigurationValueCodecs
  • Eigenverft.WebLib.Infrastructure.Hosting.DirectoryLayout
    • WebApplicationBuilderFactory
  • Eigenverft.WebLib.Infrastructure.Hosting.Features
    • HttpContextFeatureExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Hsts
    • WebLibHstsExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Kestrel
    • ConfigureWebHostBuilderExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Middleware.CanonicalHostRedirect
    • CanonicalHostMode
    • CanonicalHostRedirectExtensions
    • CanonicalHostRedirectOptions
  • Eigenverft.WebLib.Infrastructure.Hosting.Middleware.ClientNetwork
    • ClientForwardedIpAddress
    • ClientForwardedIpSource
    • ClientNetworkApplicationBuilderExtensions
    • ClientNetworkMiddleware
    • IClientNetworkFeature
  • Eigenverft.WebLib.Infrastructure.Hosting.Middleware.HealthProbeFaviconAware
    • HealthProbeFaviconAwareExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Middleware.Infrastructure
    • ApplicationBuilderMiddlewareExtensions
    • ServiceProviderRegistrationExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.Pipeline
    • PipelinePartitioningExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.RateLimiting
    • MissingClientIpBehavior
    • WebLibRequestTrafficShapingOptions
    • WebLibRequestTrafficShapingPerClientOptions
    • WebLibRequestTrafficShapingServerWideOptions
    • WebLibRequestTrafficShapingServiceCollectionExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.RequestTrafficLogging
    • RequestTrafficLoggingApplicationBuilderExtensions
    • RequestTrafficLoggingFields
    • RequestTrafficLoggingOptions
    • RequestTrafficLoggingServiceCollectionExtensions
    • SensitiveValueMode
  • Eigenverft.WebLib.Infrastructure.Hosting.SelfHttpWarmup
    • SelfHttpWarmupOptions
    • SelfHttpWarmupServiceCollectionExtensions
  • Eigenverft.WebLib.Infrastructure.Hosting.StaticFiles
    • AdditionalMappings
    • StaticFileAdditionalMappings
    • StaticFileApplicationBuilderExtensions
  • Eigenverft.WebLib.Infrastructure.Transformations
    • AspNetDataProtectionStringTransforms

Class HttpContextFeatureExtensions

Provides typed convenience access to Features.

Inheritance
object
HttpContextFeatureExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Eigenverft.WebLib.Infrastructure.Hosting.Features
Assembly: Eigenverft.WebLib.Infrastructure.dll
Syntax
public static class HttpContextFeatureExtensions

Methods

| Edit this page View Source

GetFeature<TFeature>(HttpContext)

Gets a typed feature, or null when it is not present.

Declaration
public static TFeature? GetFeature<TFeature>(this HttpContext context) where TFeature : class
Parameters
Type Name Description
HttpContext context
Returns
Type Description
TFeature
Type Parameters
Name Description
TFeature
| Edit this page View Source

GetOrCreateFeature<TFeature>(HttpContext)

Gets an existing typed feature or creates and stores one using its parameterless constructor.

Declaration
public static TFeature GetOrCreateFeature<TFeature>(this HttpContext context) where TFeature : class, new()
Parameters
Type Name Description
HttpContext context
Returns
Type Description
TFeature
Type Parameters
Name Description
TFeature
| Edit this page View Source

GetOrCreateFeature<TFeature>(HttpContext, Func<TFeature>)

Gets an existing typed feature or creates and stores one with the supplied factory.

Declaration
public static TFeature GetOrCreateFeature<TFeature>(this HttpContext context, Func<TFeature> factory) where TFeature : class
Parameters
Type Name Description
HttpContext context
Func<TFeature> factory
Returns
Type Description
TFeature
Type Parameters
Name Description
TFeature
| Edit this page View Source

GetRequiredFeature<TFeature>(HttpContext)

Gets a typed feature and throws when it is not present.

Declaration
public static TFeature GetRequiredFeature<TFeature>(this HttpContext context) where TFeature : class
Parameters
Type Name Description
HttpContext context
Returns
Type Description
TFeature
Type Parameters
Name Description
TFeature
| Edit this page View Source

RemoveFeature<TFeature>(HttpContext)

Removes a typed feature and reports whether one was present.

Declaration
public static bool RemoveFeature<TFeature>(this HttpContext context) where TFeature : class
Parameters
Type Name Description
HttpContext context
Returns
Type Description
bool
Type Parameters
Name Description
TFeature
| Edit this page View Source

SetFeature<TFeature>(HttpContext, TFeature)

Sets a typed feature in Features.

Declaration
public static void SetFeature<TFeature>(this HttpContext context, TFeature feature) where TFeature : class
Parameters
Type Name Description
HttpContext context
TFeature feature
Type Parameters
Name Description
TFeature
| Edit this page View Source

TryGetFeature<TFeature>(HttpContext, out TFeature?)

Tries to get a typed feature.

Declaration
public static bool TryGetFeature<TFeature>(this HttpContext context, out TFeature? feature) where TFeature : class
Parameters
Type Name Description
HttpContext context
TFeature feature
Returns
Type Description
bool
Type Parameters
Name Description
TFeature
  • Edit this page
  • View Source
In this article
Back to top