HostingEnvironmentExtensions Class¶
Extension methods for Microsoft.AspNetCore.Hosting.IHostingEnvironment
.
- Namespace
Microsoft.AspNetCore.Hosting
- Assemblies
- Microsoft.AspNetCore.Hosting.Abstractions
Syntax¶
public class HostingEnvironmentExtensions
-
class
Microsoft.AspNetCore.Hosting.
HostingEnvironmentExtensions
Methods¶
-
IsDevelopment
(Microsoft.AspNetCore.Hosting.IHostingEnvironment)¶ Checks if the current hosting environment name is “Development”.
Arguments: hostingEnvironment (Microsoft.AspNetCore.Hosting.IHostingEnvironment) – An instance of Microsoft.AspNetCore.Hosting.IHostingEnvironment
.Return type: System.Boolean Returns: True if the environment name is “Development”, otherwise false. public static bool IsDevelopment(this IHostingEnvironment hostingEnvironment)
-
IsEnvironment
(Microsoft.AspNetCore.Hosting.IHostingEnvironment, System.String)¶ Compares the current hosting environment name against the specified value.
Arguments: - hostingEnvironment (Microsoft.AspNetCore.Hosting.IHostingEnvironment) – An instance of
Microsoft.AspNetCore.Hosting.IHostingEnvironment
. - environmentName (System.String) – Environment name to validate against.
Return type: System.Boolean
Returns: True if the specified name is the same as the current environment, otherwise false.
public static bool IsEnvironment(this IHostingEnvironment hostingEnvironment, string environmentName)
- hostingEnvironment (Microsoft.AspNetCore.Hosting.IHostingEnvironment) – An instance of
-
IsProduction
(Microsoft.AspNetCore.Hosting.IHostingEnvironment)¶ Checks if the current hosting environment name is “Production”.
Arguments: hostingEnvironment (Microsoft.AspNetCore.Hosting.IHostingEnvironment) – An instance of Microsoft.AspNetCore.Hosting.IHostingEnvironment
.Return type: System.Boolean Returns: True if the environment name is “Production”, otherwise false. public static bool IsProduction(this IHostingEnvironment hostingEnvironment)
-
IsStaging
(Microsoft.AspNetCore.Hosting.IHostingEnvironment)¶ Checks if the current hosting environment name is “Staging”.
Arguments: hostingEnvironment (Microsoft.AspNetCore.Hosting.IHostingEnvironment) – An instance of Microsoft.AspNetCore.Hosting.IHostingEnvironment
.Return type: System.Boolean Returns: True if the environment name is “Staging”, otherwise false. public static bool IsStaging(this IHostingEnvironment hostingEnvironment)
-