Creates a AgileDotNetLicense object from its string representation.
A license object
The method may be used to install a license on a target machine without distributing the license file along the application.
using System; using System.ComponentModel; using AgileDotNet.Licensing; namespace SecuredNamespace { [LicenseProvider(typeof(AgileDotNetLicenseProvider))] public class SecuredComponent { public SecuredComponent(string licenseContent) { AgileDotNetLicense license = AgileDotNetLicenseProvider.CreateLicenseFromString(licenseContent); license.Save("MyLic"); license = LicenseManager.Validate(this.GetType(), this) as AgileDotNetLicense; } public void ExecuteProtecteMethod() { if (license.IsTrial) { // Add your code here } else { // Add your code here } } private AgileDotNetLicense license; } }
AgileDotNetLicenseProvider Class | AgileDotNet.Licensing Namespace