void IMobileObject.SetChildren(SerializationInfo info, MobileFormatter formatter) { foreach (string key in info.Children.Keys) { int referenceId = info.Children[key].ReferenceId; this.Add(key, formatter.GetObject(referenceId)); } }
/// <summary> /// Method called by MobileFormatter when an object /// should deserialize its child references. The data should be /// deserialized from the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object containing the serialized data. /// </param> /// <param name="formatter"> /// Reference to the formatter performing the deserialization. /// </param> protected override void OnSetChildren(Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter) { if (info.Children.ContainsKey("_deletedList")) { var childData = info.Children["_deletedList"]; _deletedList = (MobileList <C>)formatter.GetObject(childData.ReferenceId); } base.OnSetChildren(info, formatter); }
/// <summary> /// Method called by MobileFormatter when an object /// should deserialize its child references. The data should be /// deserialized from the SerializationInfo parameter. /// </summary> /// <param name="info"> /// Object containing the serialized data. /// </param> /// <param name="formatter"> /// Reference to the formatter performing the deserialization. /// </param> public void SetChildren(SerializationInfo info, MobileFormatter formatter) { foreach (string key in info.Children.Keys) { int referenceId = info.Children[key].ReferenceId; object serialized = formatter.GetObject(referenceId); if (serialized is ChildData) { _children.Add(key, (ChildData)serialized); } else { _values.Add(key, (FieldData)serialized); } } }
/// <summary> /// Override this method to retrieve your child object /// references from the MobileFormatter serialzation stream. /// </summary> /// <param name="info"> /// Object containing the data to serialize. /// </param> /// <param name="formatter"> /// Reference to MobileFormatter instance. Use this to /// convert child references to/from reference id values. /// </param> protected override void OnSetChildren(SerializationInfo info, MobileFormatter formatter) { if (info.Children.ContainsKey("_brokenRules")) { int referenceId = info.Children["_brokenRules"].ReferenceId; _brokenRules = (BrokenRulesCollection)formatter.GetObject(referenceId); } base.OnSetChildren(info, formatter); }
/// <summary> /// Method called by MobileFormatter when an object should deserialize its child references. The data should be deserialized from the SerializationInfo parameter. /// </summary> /// <param name="info">Object containing the serialized data.</param> /// <param name="formatter">Reference to the formatter performing the deserialization.</param> public void SetChildren(SerializationInfo info, MobileFormatter formatter) { if (info == null) throw new ArgumentNullException("info"); if (formatter == null) throw new ArgumentNullException("formatter"); if (info.Children.ContainsKey("BuildFailure")) { var childInfo = info.Children["BuildFailure"]; BuildFailure = (BuildFailure)formatter.GetObject(childInfo.ReferenceId); } }