×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    45

    Best serialization strategy for complex objects

    I need to serialize a custom control, which is divided into Control.xaml and ControlModel.cs (of course the XAML contains just the view and it's bound to the ControlModel which has the properties).

    The ControlModel contains a List<CustomControl> where CustomControl can be any of a set of custom controls that I built (each custom control extends this CustomControl class used in the list).

    So, serializing the control will require me to serialize this list, and here's the problem:
    provided that each CustomControl is built using a XAML file and a model (which is defined as a static resource into the XAML), what's the best way to serialize all those components?

    I'm finding it hard because I don't know how to work with both XAML and model.
    I mean, I know that I need to serialize just the model, as serializing a view makes no sense, but how can I then deserialize the model and assign it to the view again?
    And how can I just serialize the model if I'm serializing a list which contains the UserControl childs?

    Keep in mind that those custom controls have simple properties (the most complex property used is just a Color).

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: Best serialization strategy for complex objects

    You may want to add custom serialization for both the class with the List and to the classes which it can contain. Something what is described in http://msdn.microsoft.com/en-us/libr.../ty01x675.aspx or http://msdn.microsoft.com/en-us/libr...ializable.aspx

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    45

    Re: Best serialization strategy for complex objects

    Since there's no binary formatter available on Wp, does this work with SharpSerializer or similar stuff?

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: Best serialization strategy for complex objects

    If it supports WP7, which it appears to do - then yes.

    Also, you might want to look into ServiceStack.Text which is an extremely fast JSON serialiser.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,688

    Re: Best serialization strategy for complex objects

    Quote Originally Posted by StepTNT View Post
    Since there's no binary formatter available on Wp, does this work with SharpSerializer or similar stuff?
    Honestly I do not know. I remember ISerializable from my past, and I was clicking around on MSDN until I found something. But I have no SDK here, so I could not check if it was real (and actually it was hard to find, and I see the message on the top that it is coming from a different part of the docs).
    Now I tend to think there is still an XmlSerializer, just dealing with XML is neither fast, nor compact. SharpSerializer in binary mode sounds a lot better, so does seem their benchmarks.

Similar Threads

  1. Serialization of TTime/TInt64
    By digitalsol in forum Symbian
    Replies: 1
    Last Post: 2010-07-08, 11:11
  2. Saving files, serialization
    By TacB0sS in forum Mobile Java General
    Replies: 5
    Last Post: 2009-09-11, 10:53
  3. Serialization Framework for CLDC
    By phibo in forum Mobile Java General
    Replies: 1
    Last Post: 2006-11-08, 20:02
  4. Serialization in C++
    By burnik in forum Symbian
    Replies: 1
    Last Post: 2004-12-20, 18:44
  5. Serialization Problem on the 9210
    By branste in forum Mobile Java General
    Replies: 0
    Last Post: 2002-05-14, 12:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×