Problem to serialize object with lists

Oct 8, 2012 at 8:11 AM

Hello all,

I have a problem to serializing a class with lists/collection. When I try to convert the collections I got an error: Can't get value from AdditionalItems, when loading the collection before serializing it works fine but I don't want to load the collection manually. Here some code snippets

 

[Serializable]
    [JsonObject(MemberSerialization.OptIn)]
    public class Costs: BasicPersistentObject, IPropertyValueValidator
    {
        #region field
        EnumType _enumtype;
        [JsonProperty]
        public EnumType BlendType
        {
            get { return _enumtype; }
            set { SetPropertyValue("EnumType ", ref _enumtype, value); }
        }

[JsonProperty]           
        public XPCollection AdditionalItems
        {
            get
            {
                return GetCollection("AdditionalItems");
            }
        }

//It fails here

....

When I use object.AdditionalItems.load() serializing works fine, is it possible to load this collections automatic upon serializing?

Thanks,

Freez