Edit

Share via


LicenseProvider Class

Definition

Provides the abstract base class for implementing a license provider.

C#
public abstract class LicenseProvider
Inheritance
LicenseProvider
Derived

Examples

The following code example creates a licensed control using the Validate method. It uses a LicenseProvider that is implemented by the LicFileLicenseProvider class.

C#
using System;
using System.ComponentModel;
using System.Windows.Forms;

// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyControl : Control 
{
 
   // Creates a new, null license.
   private License license = null;
 
   public MyControl () 
   {
 
      // Adds Validate to the control's constructor.
      license = LicenseManager.Validate(typeof(MyControl), this);
 
      // Insert code to perform other instance creation tasks here.
   }
 
   protected override void Dispose(bool disposing) 
   {
      if(disposing)
      {
         if (license != null) 
         {
            license.Dispose();
            license = null;
         }
      }
   }
}

Notes to Implementers

When you inherit from LicenseProvider, you must override the GetLicense(LicenseContext, Type, Object, Boolean) method.

See LicFileLicenseProvider for an implementation of this class. For more information on licensing, see How to: License Components and Controls.

Constructors

LicenseProvider()

Initializes a new instance of the LicenseProvider class.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLicense(LicenseContext, Type, Object, Boolean)

When overridden in a derived class, gets a license for an instance or type of component, when given a context and whether the denial of a license throws an exception.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also