LicenseProvider.GetLicense(LicenseContext, Type, Object, Boolean) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當在衍生類別中被覆寫時,會獲得某個實例或元件類型的授權,並在給予上下文以及是否因拒絕授權而拋出例外時。
public:
abstract System::ComponentModel::License ^ GetLicense(System::ComponentModel::LicenseContext ^ context, Type ^ type, System::Object ^ instance, bool allowExceptions);
public abstract System.ComponentModel.License? GetLicense(System.ComponentModel.LicenseContext context, Type type, object? instance, bool allowExceptions);
public abstract System.ComponentModel.License GetLicense(System.ComponentModel.LicenseContext context, Type type, object instance, bool allowExceptions);
abstract member GetLicense : System.ComponentModel.LicenseContext * Type * obj * bool -> System.ComponentModel.License
Public MustOverride Function GetLicense (context As LicenseContext, type As Type, instance As Object, allowExceptions As Boolean) As License
參數
- context
- LicenseContext
LicenseContext A 指定你可以在哪裡使用授權物件。
- instance
- Object
一個請求授權的物件。
- allowExceptions
- Boolean
true 若當元件無法獲得授權時應拋出 a LicenseException ;否則,則 false。
傳回
一個有效的 License。
給實施者的注意事項
當你從 繼承 時 LicenseProvider,必須覆寫 GetLicense(LicenseContext, Type, Object, Boolean) 以實作授權金鑰的驗證方法。