View previous topic :: View next topic |
Author |
Message |
Guest
|
Posted: Mon Jul 17, 2006 7:35 am Post subject: A small suggestion, please |
|
|
Hello
suppose I have these two controls:
Code: |
Public Class EnhancedTextBox
Inherits TextBox
Public Sub New()
'Licensing
Licensing.EncryptedLicenseProvider.CheckLicense(GetType(EnhancedTextBox), Me)
'Other initialization code goes here
End Sub
End Class
Public Class EnhancedTextBoxSmart
Inherits EnhancedTextBox
Public Sub New()
'Licensing
Licensing.EncryptedLicenseProvider.CheckLicense(GetType(EnhancedTextBoxSmart), Me)
End Sub
End Class
|
Currently, the license check for EnhancedTextBoxSmart is performed twice. The first for EnhancedTextBox, and the second for EnhancedTextBoxSmart.
What is the best way for having the license checked only once (for EnhancedTextBoxSmart and NOT for its parent EnhancedTextBox)?
Thank you. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jul 17, 2006 9:17 am Post subject: |
|
|
Do you license the two controls separately? If not then you don't need to bother checking the license in the derived control - since the base class will check it. _________________ Infralution Support |
|
Back to top |
|
|
Guest
|
Posted: Mon Jul 17, 2006 1:09 pm Post subject: |
|
|
Infralution wrote: | Do you license the two controls separately? |
Yes.
The very simple situation I described here is very common on our packages. i.e. we have some controls sold as "base" packages, and other controls (that inherits from "base" controls) sold separately.
At the moment, for EnhancedTextBoxSmart, the NAG window requiring license key is asked twice: one for the base class and one for the derived |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jul 17, 2006 10:32 pm Post subject: |
|
|
In that case I suggest that in the constructor of your controls you check the assembly that is calling it and only do the licensing check if it isn't being called from the same assembly eg
Code: | if (Assembly.GetCallingAssembly() != Assembly.GetExecutingAssembly())
{
// check license
} |
_________________ Infralution Support |
|
Back to top |
|
|
|