Click or drag to resize
TrialRestriction Class
Represents a Restriction typically used to define trial licenses. The trial restriction can limit the number of days the license can be used, the number of application instances that can run simultaneously, the total number of executions and the running time.
Inheritance Hierarchy

Namespace:  Babel.Licensing
Assemblies:   Babel.Licensing (in Babel.Licensing.dll) Version: 2.3.3.0
  Babel.Licensing (in Babel.Licensing.dll) Version: 2.3.3.0
Syntax
public class TrialRestriction : Restriction

The TrialRestriction type exposes the following members.

Constructors
  NameDescription
Public methodTrialRestriction
Initializes a new instance of the TrialRestriction class.
Top
Properties
  NameDescription
Public propertyExpireDate
Gets or sets the expire date after which the license is no longer valid.
(Inherited from Restriction.)
Public propertyExpireDays
Gets the number of days after which the license expires.
Public propertyId
Gets the restriction identifier.
(Inherited from Restriction.)
Public propertyName
Gets the restriction name.
(Overrides RestrictionName.)
Public propertyRunCount
Gets the number of runs after which the license expires.
Public propertyRunInstances
Gets or sets the number of the software instances that are allowed to run simultaneously.
Public propertyRunTime
Gets the time that the software is allowed to run before the license expires.
Public propertyTerms
Gets the license trial terms.
Public propertyTimeLeft
Gets the time remaining before the license expires.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValidate
Validates the current trial license restriction.
(Overrides RestrictionValidate(ILicenseContext, Type, Object).)
Top
Examples
// Creates a 30 days trial XML license using fluent API
var signer = XmlDigitalSignature.CreateFromKeyFile("Keys.snk");

string licenseXML = new XmlLicense().ForAssembly("ACME.Web, Version=1.0.0.0")
                                    .WithTrialDays(30)
                                    .SignWith(signer)
                                    .ToReadableString();

//<Licenses xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
//  <License>
//    <Assembly name="ACME.Web" version="1.0.0.0" />
//    <Restrictions>
//      <Restriction xsi:type="Trial" Id="rD842" expireDays="30" />
//    </Restrictions>
//  </License>
//  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
//    <SignedInfo>
//      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
//      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
//      <Reference URI="">
//        <Transforms>
//          <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
//        </Transforms>
//        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
//        <DigestValue>KOKohrsJWwhuuixC1o/gIv5wUtU=</DigestValue>
//      </Reference>
//    </SignedInfo>
//    <SignatureValue>fcUu...</SignatureValue>
//  </Signature>
//</Licenses>
See Also