This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extension method for getting environment name
Fixes: #100
- Loading branch information
Praburaj
committed
Mar 16, 2015
1 parent
a10acfd
commit 3b0d5fd
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/Microsoft.AspNet.Hosting.Interfaces/HostingEnvironmentExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.Framework.Internal; | ||
|
||
namespace Microsoft.AspNet.Hosting | ||
{ | ||
public static class HostingEnvironmentExtensions | ||
{ | ||
/// <summary> | ||
/// Compares the current hosting environment name against the specified value. | ||
/// </summary> | ||
/// <param name="hostingEnvironment">An instance of <see cref="IHostingEnvironment"/> service.</param> | ||
/// <param name="environmentName">Environment name to validate against.</param> | ||
/// <returns>True if the specified name is same as the current environment.</returns> | ||
public static bool IsEnvironment( | ||
[NotNull]this IHostingEnvironment hostingEnvironment, | ||
[NotNull]string environmentName) | ||
{ | ||
return string.Equals( | ||
hostingEnvironment.EnvironmentName, | ||
environmentName, | ||
StringComparison.OrdinalIgnoreCase); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters