Remove LICENSED
from the list, and the code between #if and #endif will be ignored in the compile process.
Figure 13-12. Conditional compilation constant for licensing
688 CHAPTER 13 ?– PACKAGING AND DEPLOYMENT
The RsaLicenseProvider Class
The heart of the validation process exists inside the RsaLicenseProvider class. It inherits from
the base LicenseProvider class to implement the GetLicense method, which validates licensing
data and then returns a valid license if successful in that process. The signature for GetLicense
is as follows:
public override License GetLicense(LicenseContext context, Type type, object
instance, bool allowExceptions)
{
The first parameter is an instance of LicenseContext that informs the LicenseProvider
implementation what the current environment is. We use it to determine whether the server
control is executing within a design-time environment. The Type parameter and the Object
parameter provide access to the control type and instance that is validated. AllowExceptions is
a Boolean that indicates whether LicenseProvider should throw a LicenseException to indicate
that the control was unable to obtain a valid license. In our code, this is ignored, and instead of
raising an exception, the code returns a null value.
Pages:
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877