Table of Contents

Class HostingEnvironmentOptions

Namespace
Cuemon.AspNetCore.Hosting
Assembly
Cuemon.AspNetCore.dll

Configuration options for HostingEnvironmentMiddleware.

public class HostingEnvironmentOptions : IValidatableParameterObject, IParameterObject
Inheritance
Object
HostingEnvironmentOptions
Implements

Constructors

HostingEnvironmentOptions()

Initializes a new instance of the HostingEnvironmentOptions class.

public HostingEnvironmentOptions()

Remarks

The following table shows the initial property values for an instance of HostingEnvironmentOptions.

PropertyInitial Value
HeaderNameX-Hosting-Environment
SuppressHeaderPredicateenvironment => environment.IsProduction()

Properties

HeaderName

Gets or sets the name of the hosting environment HTTP header.

public string HeaderName { get; set; }

Property Value

String

The name of the hosting environment HTTP header.

SuppressHeaderPredicate

Gets or sets the predicate that can suppress the hosting environment HTTP header.

public Func<IHostEnvironment, bool> SuppressHeaderPredicate { get; set; }

Property Value

Func<IHostEnvironment, Boolean>

The function delegate that can determine if the hosting environment HTTP header should be suppressed.

Methods

ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

public void ValidateOptions()

Remarks

This method is expected to throw exceptions when one or more conditions fails to be in a valid state.

Exceptions

System.InvalidOperationException

HeaderName cannot be null, empty or consist only of white-space characters - or - SuppressHeaderPredicate cannot be null.