Yes you can serialize your own object but the point I was trying to make is
that it doesn't matter if you do. The runtime license gets stored at
compile time as a result of the license compiler calling
DesignTimeLicenseContext.SetSavedLicenseKey. You can't change this.
However, I think you might be able to accomplish what you need to by using
the ComponentWithCustomContext sample I referred you to. This sample
overrides creates a customer license context, replaces the existing context
with yours which causes the runtime to call your GetSavedLicenseKey method
(which has been overriden). In the GetSavedLicenseKey code it already does
a version independent check. I tested this sample and it appears to let me
update the control version without breaking an existing embedded runtime
license.
Here is the part of the code where it ignores the version:
/BEGIN CODE SNIPPET
// The DesignTimeLicenseContext used by the designers uses the versioned
// AssemblyQualifiedType as a key to the hash table. The codee locates
// a license key without checking the version.
//
// Generate the version free type name for the current licensed type
//
String currentType = StripVersionField(type.AssemblyQualifiedName);
// Store the original versioned type name in case we fail to find a match
//
String keyType = type.AssemblyQualifiedName;
// Loop over each key in the hash table and do a version free check for
// the presence of the type as a key
//
foreach (Object o in savedLicenseKeys.Keys)
{
String s = o as String;
if (s != null)
{
s = StripVersionField(s);
if (s.Equals(currentType))
{
keyType = o as String;
break;
}
}
}
return(string)savedLicenseKeys[keyType];
//END CODE SNIPPET
Brian Roder [MSFT]
This posting is provided 'AS IS' with no warranties, and confers no rights.
<
http://www.microsoft.com/info/terms.htm> Please do not send email directly to this alias. This is our online account
name for newsgroup participation only.