System.ComponentModel.LicFileLicenseProvider.GetLicense Method

Returns a license for the instance of the component, if one is available.

Syntax

public override License GetLicense (LicenseContext context, Type type, object instance, bool allowExceptions)

Parameters

context
A System.ComponentModel.LicenseContext that specifies where you can use the licensed object.
type
A Type that represents the component requesting the System.ComponentModel.License.
instance
An object that requests the System.ComponentModel.License.
allowExceptions
true if a System.ComponentModel.LicenseException should be thrown when a component cannot be granted a license; otherwise, false.

Returns

A valid System.ComponentModel.License. If this method cannot find a valid System.ComponentModel.License or a valid context parameter, it returns null.

Remarks

At design time, the LicFileLicenseProvider.GetLicense(LicenseContext, Type, object, bool) method looks for a license file named myClassName.LIC, where myClassName is the Type.FullName of the component to create. This file must be in the same directory as the .dll file that contains the component.

Next, this method checks the first line of the license file against a key specified in the LicFileLicenseProvider.IsKeyValid(string, Type) method. If the key is valid, this line is used as the License.LicenseKey.

Requirements

Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0