LicFileLicenseProvider.GetLicense Méthode

Définition

Retourne une licence éventuelle pour l'instance du composant.

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

LicenseContext spécifiant l'endroit où vous pouvez utiliser l'objet sous licence.

type
Type

Type représentant le composant qui demande le License.

instance
Object

Objet qui demande le License.

allowExceptions
Boolean

true si LicenseException doit être levé si aucune licence ne peut être accordée à un composant ; sinon, false.

Retours

License valide. Si cette méthode ne parvient pas à trouver un License valide ou un paramètre context valide, elle retourne null.

Remarques

Au moment de la conception, la GetLicense méthode recherche un fichier de licence nommé myClassName.LIC, où myClassName est le FullName du 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 comme LicenseKey.

S’applique à

Voir aussi