NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

LicFileLicenseProvider.GetLicense

Gets a license for the instance of the component and determines if it is valid.

[Visual Basic]
Overrides Public Function GetLicense( _
   ByVal context As LicenseContext, _
   ByVal type As Type, _
   ByVal instance As Object, _
   ByVal allowExceptions As Boolean _
) As License
[C#]
public override License GetLicense(
   LicenseContext context,
   Type type,
   object instance,
   bool allowExceptions
);
[C++]
public: override License* GetLicense(
   LicenseContext* context,
   Type* type,
   Object* instance,
   bool allowExceptions
);
[JScript]
public override function GetLicense(
   context : LicenseContext,
   type : Type,
   instance : Object,
   allowExceptions : Boolean
) : License;

Parameters

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

Return Value

A valid License. If this method cannot find a valid License or a valid context, it returns a null reference (in Visual Basic Nothing).

Remarks

At design time, the GetLicense method looks for a license file named "className.LIC" where className is the FullName of the component you want to create. This file must be in the same directory as the DLL with the class.

Then this method checks the first line of the license file against a key specified in the IsKeyValid method. If the key is valid, this line is used as the LicenseKey.

See Also

LicFileLicenseProvider Class | LicFileLicenseProvider Members | System.ComponentModel Namespace | License | LicenseContext | LicenseException | LicenseManager | LicenseProvider | LicenseProviderAttribute | LicFileLicenseProvider | LicenseUsageMode