Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class Microsoft.​Extensions.​Hosting.​HostingEnvironmentExtensions
Assembly: Microsoft.Extensions.Hosting.Abstractions
Inheritance: object → HostingEnvironmentExtensions
Extension methods for <see cref="T:Microsoft.Extensions.Hosting.IHostingEnvironment" /> .
Methods
public static
bool
IsDevelopment​(IHostingEnvironment hostingEnvironment)
Checks if the current hosting environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Development" /> .
Returns <see langword="true" /> if the environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Development" /> , otherwise <see langword="false" /> .
hostingEnvironment
An instance of <see cref="T:Microsoft.Extensions.Hosting.IHostingEnvironment" /> .
public static
bool
IsEnvironment​(IHostingEnvironment hostingEnvironment,
string environmentName)
Compares the current hosting environment name against the specified value.
Returns <see langword="true" /> if the specified name is the same as the current environment, otherwise <see langword="false" /> .
hostingEnvironment
An instance of <see cref="T:Microsoft.Extensions.Hosting.IHostingEnvironment" /> .
environmentName
Environment name to validate against.
public static
bool
IsProduction​(IHostingEnvironment hostingEnvironment)
Checks if the current hosting environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Production" /> .
Returns <see langword="true" /> if the environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Production" /> , otherwise <see langword="false" /> .
hostingEnvironment
An instance of <see cref="T:Microsoft.Extensions.Hosting.IHostingEnvironment" /> .
public static
bool
IsStaging​(IHostingEnvironment hostingEnvironment)
Checks if the current hosting environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Staging" /> .
Returns <see langword="true" /> if the environment name is <see cref="F:Microsoft.Extensions.Hosting.EnvironmentName.Staging" /> , otherwise <see langword="false" /> .
hostingEnvironment
An instance of <see cref="T:Microsoft.Extensions.Hosting.IHostingEnvironment" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object