CoreGetEnvironmentName Method
``
取得環境名稱
Namespace: eBizprise.FrameworkAssembly: eBizprise.Framework.Core (in eBizprise.Framework.Core.dll) Version: 26.0.0.0+6e92afb880fa099fdfe407c9aa8d1b17eaaf3625
public static string GetEnvironmentName(
string environmentVariableName = null
)
- environmentVariableName String (Optional)
- 自訂環境變數名稱 (可選)
String環境名稱,若未設定則返回 null
偵測順序:
1. 自訂環境變數名稱 (如果有提供)
2. ASPNETCORE_ENVIRONMENT
3. DOTNET_ENVIRONMENT
4. ENVIRONMENT
string env = Core.GetEnvironmentName();
// 返回: "Production", "Development", "Staging" 等
// 使用自訂環境變數
string env = Core.GetEnvironmentName("MY_CUSTOM_ENV");
| Date | Version | Description |
|---|
| 2025/12/09 | 25.0.3.0 | 新增環境名稱偵測功能 |