diff --git a/src/Microsoft.AspNet.Hosting.Abstractions/EnvironmentName.cs b/src/Microsoft.AspNet.Hosting.Abstractions/EnvironmentName.cs index 664744383c..ec2533be13 100644 --- a/src/Microsoft.AspNet.Hosting.Abstractions/EnvironmentName.cs +++ b/src/Microsoft.AspNet.Hosting.Abstractions/EnvironmentName.cs @@ -6,6 +6,7 @@ namespace Microsoft.AspNet.Hosting public static class EnvironmentName { public static readonly string Development = "Development"; + public static readonly string Staging = "Staging"; public static readonly string Production = "Production"; } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Hosting.Abstractions/HostingEnvironmentExtensions.cs b/src/Microsoft.AspNet.Hosting.Abstractions/HostingEnvironmentExtensions.cs index 1d62b061dc..ca638841b2 100644 --- a/src/Microsoft.AspNet.Hosting.Abstractions/HostingEnvironmentExtensions.cs +++ b/src/Microsoft.AspNet.Hosting.Abstractions/HostingEnvironmentExtensions.cs @@ -9,10 +9,10 @@ namespace Microsoft.AspNet.Hosting public static class HostingEnvironmentExtensions { /// - /// Checks if the current hosting environment name is development. + /// Checks if the current hosting environment name is "Development". /// - /// An instance of service. - /// True if the environment name is Development, otherwise false. + /// An instance of . + /// True if the environment name is "Development", otherwise false. public static bool IsDevelopment(this IHostingEnvironment hostingEnvironment) { if (hostingEnvironment == null) @@ -24,10 +24,25 @@ namespace Microsoft.AspNet.Hosting } /// - /// Checks if the current hosting environment name is Production. + /// Checks if the current hosting environment name is "Staging". /// - /// An instance of service. - /// True if the environment name is Production, otherwise false. + /// An instance of . + /// True if the environment name is "Staging", otherwise false. + public static bool IsStaging(this IHostingEnvironment hostingEnvironment) + { + if (hostingEnvironment == null) + { + throw new ArgumentNullException(nameof(hostingEnvironment)); + } + + return hostingEnvironment.IsEnvironment(EnvironmentName.Staging); + } + + /// + /// Checks if the current hosting environment name is "Production". + /// + /// An instance of . + /// True if the environment name is "Production", otherwise false. public static bool IsProduction(this IHostingEnvironment hostingEnvironment) { if (hostingEnvironment == null) @@ -41,9 +56,9 @@ namespace Microsoft.AspNet.Hosting /// /// Compares the current hosting environment name against the specified value. /// - /// An instance of service. + /// An instance of . /// Environment name to validate against. - /// True if the specified name is same as the current environment. + /// True if the specified name is the same as the current environment, otherwise false. public static bool IsEnvironment( this IHostingEnvironment hostingEnvironment, string environmentName) @@ -60,11 +75,11 @@ namespace Microsoft.AspNet.Hosting } /// - /// Gives the physical path corresponding to the given virtual path. + /// Determines the physical path corresponding to the given virtual path. /// - /// An instance of service. - /// Path relative to the root. - /// Physical path corresponding to virtual path. + /// An instance of . + /// Path relative to the application root. + /// Physical path corresponding to the virtual path. public static string MapPath( this IHostingEnvironment hostingEnvironment, string virtualPath)