problem when serializing a TimeSpan property

Posts   
 
    
olavS
User
Posts: 2
Joined: 27-Mar-2009
# Posted on: 27-Mar-2009 15:41:30   

Hello

We are using LLBLGen 2.5 Final (5. December 2007).

We use a custom TypeConverter to convert a field from an integer to a System.TimeSpan in the LLBLGen designer. Everything works fine - fetching, saving etc - as long as we don’t serialize an entity containing a TimeSpan field. The xml after a call to entity.WriteXml(…) also looks just fine:


<WorkItemWithProductInfoEntity Assembly="Test.DBLayer, Version=1.0.3373.25196, Culture=neutral, PublicKeyToken=null" Type="Test.DBLayer.EntityClasses.TestEntity">
  <Fields>
    <LengthInDays>
      <CurrentValue Type="System.TimeSpan">4.00:00:00</CurrentValue>
      <DbValue Type="System.TimeSpan">4.00:00:00</DbValue>
      <IsChanged>False</IsChanged>
      <IsNull>False</IsNull>
    </LengthInDays>
.. more xml

But when we read the entity with a call to entity.ReadXml(…) we get “'entity.LengthInDays' threw an exception of type 'System.InvalidCastException'”. Any idea why this happens?

Olav

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Mar-2009 20:12:00   

Hi Olav,

This coud be realted to this old fix: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=13468&StartAtMessage=0&#75914

Please update to the latest runtime library version (downloadable from the customer's area) and if possible download the full version. Then try again.

David Elizondo | LLBLGen Support Team
olavS
User
Posts: 2
Joined: 27-Mar-2009
# Posted on: 01-Apr-2009 11:46:44   

Thank you,

We updated to 2.6 (was time anyway wink ) - and now it works just fine.