LicFileLicenseProvider.GetLicense 方法

返回组件实例的许可证(如果有一个可用的话)。

**命名空间:**System.ComponentModel
**程序集:**System(在 system.dll 中)

语法

声明
Public Overrides Function GetLicense ( _
    context As LicenseContext, _
    type As Type, _
    instance As Object, _
    allowExceptions As Boolean _
) As License
用法
Dim instance As LicFileLicenseProvider
Dim context As LicenseContext
Dim type As Type
Dim instance As Object
Dim allowExceptions As Boolean
Dim returnValue As License

returnValue = instance.GetLicense(context, type, instance, allowExceptions)
public override License GetLicense (
    LicenseContext context,
    Type type,
    Object instance,
    bool allowExceptions
)
public:
virtual License^ GetLicense (
    LicenseContext^ context, 
    Type^ type, 
    Object^ instance, 
    bool allowExceptions
) override
public License GetLicense (
    LicenseContext context, 
    Type type, 
    Object instance, 
    boolean allowExceptions
)
public override function GetLicense (
    context : LicenseContext, 
    type : Type, 
    instance : Object, 
    allowExceptions : boolean
) : License

参数

  • context
    一个 LicenseContext,指定可在何处使用已授权的对象。
  • instance
    请求 License 的对象。
  • allowExceptions
    如果无法授予组件许可证时应引发 LicenseException,则为 true;否则为 false

返回值

有效的 License。如果该方法未能找到有效的 License 或有效的 context 参数,它返回 空引用(在 Visual Basic 中为 Nothing)。

备注

在设计时,GetLicense 方法查找名为 myClassName.LIC 的许可证文件,其中 myClassName 是要创建的组件的 FullName。该文件必须和包含该组件的 .dll 文件在同一个目录中。

然后,该方法依据 IsKeyValid 方法中指定的密钥检查许可证文件的第一行。如果该密钥有效,则此行用作 LicenseKey

平台

Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

LicFileLicenseProvider 类
LicFileLicenseProvider 成员
System.ComponentModel 命名空间
License 类
LicenseContext 类
LicenseException 类
LicenseManager 类
LicenseProvider 类
LicenseProviderAttribute 类
LicFileLicenseProvider 类
LicenseUsageMode 枚举