LicFileLicenseProvider.GetLicense メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コンポーネントのインスタンスのライセンス (使用可能な場合) を返します。
public:
override System::ComponentModel::License ^ GetLicense(System::ComponentModel::LicenseContext ^ context, Type ^ type, System::Object ^ instance, bool allowExceptions);
public override System.ComponentModel.License? GetLicense(System.ComponentModel.LicenseContext context, Type type, object? instance, bool allowExceptions);
public override System.ComponentModel.License GetLicense(System.ComponentModel.LicenseContext context, Type type, object instance, bool allowExceptions);
override this.GetLicense : System.ComponentModel.LicenseContext * Type * obj * bool -> System.ComponentModel.License
Public Overrides Function GetLicense (context As LicenseContext, type As Type, instance As Object, allowExceptions As Boolean) As License
パラメーター
- context
- LicenseContext
ライセンスされたオブジェクトを使用できる場所を指定する LicenseContext 。
- allowExceptions
- Boolean
true コンポーネントにライセンスを付与できないときに LicenseException をスローする必要がある場合は a0/>。それ以外の場合は false。
返品
有効な License。 このメソッドが有効な License または有効な context パラメーターを見つけることができない場合は、 nullを返します。
注釈
デザイン時に、 GetLicense メソッドは、 myClassName.LICという名前のライセンス ファイルを検索します。ここで、 myClassName は作成するコンポーネントの FullName です。 このファイルは、コンポーネントを含む .dll ファイルと同じディレクトリに存在する必要があります。
次に、このメソッドは、ライセンス ファイルの最初の行を、 IsKeyValid メソッドで指定されたキーと照合します。 キーが有効な場合、この行は LicenseKeyとして使用されます。