IHostEnvironment 介面

定義

提供應用程式執行所在的主控環境相關資訊。Provides information about the hosting environment an application is running in.

public interface class IHostEnvironment
public interface IHostEnvironment
type IHostEnvironment = interface
Public Interface IHostEnvironment

屬性

ApplicationName

取得或設定應用程式的名稱。Gets or sets the name of the application. 主機會自動將此屬性設定為包含應用程式進入點的組件。This property is automatically set by the host to the assembly containing the application entry point.

ContentRootFileProvider

取得或設定指向 ContentRootPathIFileProviderGets or sets an IFileProvider pointing at ContentRootPath.

ContentRootPath

取得或設定包含應用程式內容檔案的目錄絕對路徑。Gets or sets the absolute path to the directory that contains the application content files.

EnvironmentName

取得或設定環境的名稱。Gets or sets the name of the environment. 主機會自動將此屬性設為組態中指定的 "environment" 索引鍵值。The host automatically sets this property to the value of the "environment" key as specified in configuration.

擴充方法

IsDevelopment(IHostEnvironment)

檢查目前主機環境名稱是否為 DevelopmentChecks if the current host environment name is Development. 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。This API should not be used in libraries, see remarks for details.

IsEnvironment(IHostEnvironment, String)

比較目前主機環境名稱與指定的值。Compares the current host environment name against the specified value. 程式庫作者應避免使用此 API,如需詳細資料,請參閱備註。Library authors should avoid using this API, see remarks for details.

IsProduction(IHostEnvironment)

檢查目前主機環境名稱是否為 ProductionChecks if the current host environment name is Production. 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。This API should not be used in libraries, see remarks for details.

IsStaging(IHostEnvironment)

檢查目前主機環境名稱是否為 StagingChecks if the current host environment name is Staging. 此 API 不應用於程式庫中,如需詳細資料,請參閱備註。This API should not be used in libraries, see remarks for details.

適用於