LicenseProvider.GetLicense(LicenseContext, Type, Object, Boolean) 方法

定義

當在衍生類別中被覆寫時,會獲得某個實例或元件類型的授權,並在給予上下文以及是否因拒絕授權而拋出例外時。

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 指定你可以在哪裡使用授權物件。

type
Type

A Type 代表請求授權的元件。

instance
Object

一個請求授權的物件。

allowExceptions
Boolean

true 若當元件無法獲得授權時應拋出 a LicenseException ;否則,則 false

傳回

一個有效的 License

給實施者的注意事項

當你從 繼承 時 LicenseProvider,必須覆寫 GetLicense(LicenseContext, Type, Object, Boolean) 以實作授權金鑰的驗證方法。

適用於

另請參閱