Serialize LLBL object and children - best approach

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 03-Apr-2008 14:25:23   

I have an order object with lots of children (SelfServicing, C#)

What's the best way to serialize the object into XML to view it.

I seem to remember something about an optimized serialization feature?

Here's what I tried:

XmlSerializer serializer = new XmlSerializer(TheLLBLObject.GetType());
Stream writer = new FileStream(outputXMLfilename, FileMode.Create);
serializer.Serialize(writer, Class);
writer.Close();

but I get the error: A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

Thanks, Ian

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Apr-2008 15:21:45   

There is an example in the manual under Using the generated code -> XML Support (serialization, de-serialization)

Also the following thread might be helpful to you: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6267