HostingEnvironmentOptions Class
Definition
- Namespace
- Cuemon.AspNetCore.Hosting
- Assemblies
- Cuemon.AspNetCore.dll
Configuration options for HostingEnvironmentMiddleware.
public class HostingEnvironmentOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
HostingEnvironmentOptions
- Implements
Examples
The following example demonstrates how to configure hosting environment options.
using System;
using Microsoft.Extensions.Hosting;
namespace Cuemon.AspNetCore.Hosting;
public static class HostingEnvironmentOptionsExample
{
public static void Demonstrate()
{
var options = new HostingEnvironmentOptions
{
HeaderName = "X-Environment",
SuppressHeaderPredicate = environment => environment.IsProduction()
};
options.ValidateOptions();
Console.WriteLine(options.HeaderName);
}
}
Constructors
| Name | Description |
|---|---|
| HostingEnvironmentOptions() | Initializes a new instance of the HostingEnvironmentOptions class. |
Properties
| Name | Description |
|---|---|
| HeaderName | Gets or sets the name of the hosting environment HTTP header. |
| SuppressHeaderPredicate | Gets or sets the predicate that can suppress the hosting environment HTTP header. |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |