Custom Limits with the Embeddable Source

The Creating a Custom Limit topic in the Developers Guide describes how to create your own custom license limit. If you are using the embeddable C# runtime, you will need to make a few changes. 

On This Page

At runtime, your licensed project will include the DeployLX.Licensing.v5.cs file directly in your project and there won't be any references to the DeployLX.Licensing.v5.dll. When you create a custom limit, this does not change. The problem you'll face however, is editing a license in DeployLX that uses your custom limit. Since your custom limit does not derive from the type defined in the DeployLX.Licensing.v5.dll runtime the DeployLX Manager will not be able to load it.

To fix this you'll create a special helper project that acts as a shim to the DeployLX Manager. After following all the instructions in the README.TXT included with the embeddable source code you will need to perform the following additional steps.

Creating the Helper Shim

  1. Open your existing solution in Visual Studio.
  2. Create a new class library project named CustomEditor.
  3. Add a reference to the binary runtime DeployLX.Licening.v5.dll.
  4. With the shim project selected, select Project | Add Existing Item.
  5. Navigate to your existing project with the custom limit and select your CustomLimit.cs file.
  6. Don't select Add. Instead select the drop down arrow just beside it and select Add As Link.

You've now created the shim class that you will register in the DeployLX Manager application.

Registering the Helper Shim

  1. Open the DeployLX Manager.
  2. Select the Application Menu followed by DeployLX Options.
  3. Select Licensing | Custom Limits.
  4. Select Add.
  5. Browse for the CustomLimit.dll in the project output folder and select Open.
  6. Select OK, OK to close the options dialog.

Now you can add references to your custom limit to licenses in the Advanced License Editor. However, DeployLX will add a reference to the shim assembly instead of the assembly you distribute with your project. You'll make one final change to the CustomLimit.cs class.

Updating the Custom Limit

Override the QualifiedTypeName property of your custom limit with the following code. This enables DeployLX to serialize just the information needed to connect the license to your custom limit at runtime.

Public Overrides ReadOnly Property QualifiedTypeName() As String
    Get
        Return GetType(MyCustomLimit).FullName
    End Get
End Property
public override string QualifiedTypeName
{
    get
    {
        return typeof( MyCustomLimit ).FullName;
    }
}
Published : Feb 25, 2009
Updated : Jan 04, 2012
Views : 3863
  • licensing
  • deploylx
  • code

Applies To

Downloads

Folder