LicFileLicenseProvider.GetLicense Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne une licence pour l’instance du composant, si celle-ci est disponible.
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
Paramètres
- context
- LicenseContext
Qui LicenseContext spécifie où vous pouvez utiliser l’objet sous licence.
- allowExceptions
- Boolean
true si un LicenseException élément doit être levée lorsqu’un composant ne peut pas recevoir de licence ; sinon, false.
Retours
Valide License. Si cette méthode ne trouve pas de paramètre valide License ou valide context , elle retourne null.
Remarques
Au moment du design, la GetLicense méthode recherche un fichier de licence nommé myClassName.LIC, où myClassName est le FullName composant à créer. Ce fichier doit se trouver dans le même répertoire que le fichier .dll qui contient le composant.
Ensuite, cette méthode vérifie la première ligne du fichier de licence par rapport à une clé spécifiée dans la IsKeyValid méthode. Si la clé est valide, cette ligne est utilisée en tant que LicenseKey.