In SelfServicing, I have a LLBLGen generated class called Person. I created a class called Patient that inherits from this class. This new class has properties of datatype string that are not part of the Person class but the code contained in the get and set refers to properties in the Person class.
_ Public Class Patient
Inherits PersonEntity
Public Property DOB() As Date
Get
Return Me.BirthTime
End Get
Set(ByVal Value As Date)
Me.BirthTime = Value
End Set
End Property
End Class _
When I generate XML from the Patient class and read it back in, I get an error (Specified argument was out of the range of valid values. Parameter name: Index was out of range. Must be non-negative and less than the size of the collection.) when it tries to set the properties from the Patient class.
_ Dim writer As New StreamWriter("patient.xml")
Dim patientXml As String = String.Empty
Dim myPatient As New Patient(13)
If Not myPatient.IsNew Then
myPatient.WriteXml(patientXml)
writer.Write(patientXml)
End If
writer.Close()
Dim reader As New StreamReader("patient.XML")
Dim xmlFromFile As String = reader.ReadToEnd()
reader.Close()
Dim patientFromXml As New Tables.Patient
patientFromXml.ReadXml(xmlFromFile)
_
I have debugged the problem down to the following line in EntityBase.Xml2Entity,
properties[currentElement.Name].SetValue(this, typeConverter.XmlValueToObject(elementTypeName, xmlValue));
where this = Patient class, currentElement.Name = "DOB", elementTypeName = "System.Date", and xmlValue = "622093824000000000"
Any ideas as to what I might be doing wrong?