SecureTeam Copy Protection


Gets a license for an instance or type of component. The license found is validated against its Locks


Public Overrides Sub GetLicense( _
   ByVal context As LicenseContext, _
   ByVal type As Type, _
   ByVal instance As Object, _
   ByVal allowExceptions As Boolean _
public override License GetLicense(
   LicenseContext context,
   Type type,
   object instance,
   bool allowExceptions


A LicenseContext that specifies where you can use the licensed object.
A Type that represents the component requesting the license.
An object that is requesting the license.
true if a LicenseException should be thrown when the component cannot be granted a license; otherwise, false.

Return Value

A valid AgileDotNetLicense.


The method looks for all license files ending with 'lic' extension located at the application's code base directory. It then validates each license with its Locks, the first valid license is then returned to the caller. A LicenseNotFoundException is thrown when the component cannot be granted a license, alternatively if allowExceptions is set to false a null value is returned.

This method cannot be called directly, it's called by decorating the licensed type with a LicenseProviderAttribute attribute, and then validating the license by calling Validate. Alternatively you can call Validate directly.


Exception TypeCondition
LicenseNotFoundExceptionThrown when the system cannot find a valid license.

See Also

AgileDotNetLicenseProvider Class | AgileDotNet.Licensing Namespace