This is a follow up to http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10271
The new code fixed the issue of serializing Nullable types but has brought to light a new issue. When WriteXml writes a Nullable property, they UnderlyingSystemType.FullName is the nullable type name which is correctly emitted as the "Type" attribute.
The full name is then passed to the XmlHelper.PropertyValueToString method as the valueTypeName which does not distinquish the underlying generic type correctly so if falls through the switch statement to the default and uses propertyValue.ToString.
In most cases this is probably not an issue, but with DateTime? it is outputing an invalid DateTime format (MM/dd/yyyy HH:mm am/pm) instead of converting to ticks. This is causing a problem on the ReadXml because it is passing the value to XmlConvert.ToDateTime which blows up with:
System.FormatException: The string '7/12/2007 12:00:00 AM' is not a valid AllXsd value.
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at SD.LLBLGen.Pro.ORMSupportClasses.XmlHelper.XmlValueToObject(String typeName, String xmlValue)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlNode node, Dictionary2 processedObjectIDs, List
1 nodeEntityReferences)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlNode node)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlReader reader)
using .NET 2.0 runtime - 2.0.7.705
Anyway you can get the generic type and pass it into PropertyValueToString?
Brian Chance