Share via


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,指定您可以使用授權物件的位置。

type
Type

Type,表示要求授權的元件。

instance
Object

正在要求授權的物件。

allowExceptions
Boolean

如果元件無法取得授權時應該擲回 LicenseException,則為 true,否則為 false

傳回

有效的 License

給實施者的注意事項

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

適用於

另請參閱