RazorDocs Search
API Reference

Defaults

Type

NoHostModule

Source

A basic implementation of IAppSurfaceHostModule that does nothing. This is useful for providing implementations of apps that do not require a module.

Remarks

Use NoHostModule only when no part of the application expects module-provided services, dependency registrations, middleware, endpoints, or host configuration. It is safe for minimal hosts that rely entirely on framework defaults. Create a real IAppSurfaceHostModule when the app needs service registration, dependency wiring, or host lifecycle hooks.

Method

ConfigureServices

void ConfigureServices(StartupContext context, IServiceCollection services) Source

Configures services for the module. This implementation is empty.

Parameters

  • contextThe startup context.
  • servicesThe service collection.

Remarks

No services are added. Callers that expect module-owned services must not use NoHostModule.

Method

RegisterDependentModules

void RegisterDependentModules(ModuleDependencyBuilder builder) Source

Registers dependent modules. This implementation is empty.

Parameters

  • builderThe module dependency builder.

Remarks

No dependencies are declared. Create a concrete module when startup ordering or dependency modules matter.

Method

ConfigureHostBeforeServices

void ConfigureHostBeforeServices(StartupContext context, IHostBuilder builder) Source

Configures the host before services are registered. This implementation is empty.

Parameters

  • contextThe startup context.
  • builderThe host builder.

Remarks

No host configuration is applied before service registration.

Method

ConfigureHostAfterServices

void ConfigureHostAfterServices(StartupContext context, IHostBuilder builder) Source

Configures the host after services are registered. This implementation is empty.

Parameters

  • contextThe startup context.
  • builderThe host builder.

Remarks

No host configuration is applied after service registration.

Type

InternalServicesModule

Source

Internal Services Registration

Type

DefaultEnvironmentProvider

Source

Default implementation of IEnvironmentProvider that retrieves the environment from system environment variables. It checks for "ASPNETCORE_ENVIRONMENT" first, then "DOTNET_ENVIRONMENT", and defaults to "Production" if neither is set. Can be overridden by passing a custom implementation to the StartupContext, when building the host.

Method

GetEnvironmentVariable

string? GetEnvironmentVariable(string name, string? defaultValue = null) Source

Gets the value of an environment variable from the system.

Parameters

  • nameThe exact environment variable name to query.
  • defaultValueThe default value to return if the environment variable is unset.

Returns

The environment variable value, an empty string when explicitly set empty, or the provided default if the variable is unset.

Remarks

Use GetEnvironmentVariable when callers need the provider's centralized lookup and unset-value defaulting behavior. Use Environment or IsDevelopment for the active application environment, and prefer direct System.Environment access only for low-level infrastructure code. Passing a null or empty name follows System.Environment.GetEnvironmentVariable(string) semantics. Do not log returned values unless the variable is known to be non-sensitive, and do not trim or alter casing unless the caller intentionally wants to change the platform-specific value.

Property

Environment

string Environment { get; } Source

The current environment name. Read from "ASPNETCORE_ENVIRONMENT" or "DOTNET_ENVIRONMENT" environment variables, defaults to "Production" if neither is set.

Property

IsDevelopment

bool IsDevelopment { get; } Source

True if the current environment is "Development".