Source/Csla/Serialization/Mobile/MobileFormatter.cs
/// <summary>
/// Deserialize an object from DTO graph.
/// </summary>
///<param name="deserialized">DTO group to deserialize</param>
/// <returns></returns>
Deserialize an object from DTO graph.
Deserialize an object from DTO graph .
public object DeserializeAsDTO(List<SerializationInfo> deserialized)
    {
      _deserializationReferences = new Dictionary<int, IMobileObject>();
      foreach (SerializationInfo info in deserialized)
      {
        var typeName = AssemblyNameTranslator.GetAssemblyQualifiedName(info.TypeName);
        Type type = GetTypeFromCache(typeName);
        if (type == null)
        {
          throw new SerializationException(string.Format(
            Resources.MobileFormatterUnableToDeserialize, typeName));
        }
        else if (type == typeof(NullPlaceholder))
        {
          _deserializationReferences.Add(info.ReferenceId, null);
        }
        else
        {
          if (type.Equals(typeof(Security.CslaClaimsPrincipal)))
          {
            var state = info.GetValue<byte[]>("s");
            using (var buffer = new System.IO.MemoryStream(state))
            {
              using (var reader = new System.IO.BinaryReader(buffer))
              {
                IMobileObject mobile = (IMobileObject)new Security.CslaClaimsPrincipal(reader);
                _deserializationReferences.Add(info.ReferenceId, mobile);
              }
            }
          }
          else
          {
            IMobileObject mobile = (IMobileObject)Activator.CreateInstance(type);
            _deserializationReferences.Add(info.ReferenceId, mobile);
            ConvertEnumsFromIntegers(info);
            mobile.SetState(info);
          }
        }
      }
      foreach (SerializationInfo info in deserialized)
      {
        IMobileObject mobile = _deserializationReferences[info.ReferenceId];
        if (mobile != null)
        {
          mobile.SetChildren(info, this);
        }
      }
      foreach (SerializationInfo info in deserialized)
      {
        ISerializationNotification notifiable = _deserializationReferences[info.ReferenceId] as ISerializationNotification;
        if (notifiable != null)
          notifiable.Deserialized();
      }
      return (_deserializationReferences.Count > 0 ? _deserializationReferences[1] : null);
    }
public object DeserializeAsDTO ( List < SerializationInfo > deserialized ) { _deserializationReferences = new Dictionary < int , IMobileObject > ( ) ; foreach ( SerializationInfo info in deserialized ) { var typeName = AssemblyNameTranslator . GetAssemblyQualifiedName ( info . TypeName ) ; Type type = GetTypeFromCache ( typeName ) ; if ( type == null ) { throw new SerializationException ( string . Format ( Resources . MobileFormatterUnableToDeserialize , typeName ) ) ; } else if ( type == typeof ( NullPlaceholder ) ) { _deserializationReferences . Add ( info . ReferenceId , null ) ; } else { if ( type . Equals ( typeof ( Security . CslaClaimsPrincipal ) ) ) { var state = info . GetValue < byte [ ] > ( " " ) ; using ( var buffer = new System . IO . MemoryStream ( state ) ) { using ( var reader = new System . IO . BinaryReader ( buffer ) ) { IMobileObject mobile = ( IMobileObject ) new Security . CslaClaimsPrincipal ( reader ) ; _deserializationReferences . Add ( info . ReferenceId , mobile ) ; } } } else { IMobileObject mobile = ( IMobileObject ) Activator . CreateInstance ( type ) ; _deserializationReferences . Add ( info . ReferenceId , mobile ) ; ConvertEnumsFromIntegers ( info ) ; mobile . SetState ( info ) ; } } } foreach ( SerializationInfo info in deserialized ) { IMobileObject mobile = _deserializationReferences [ info . ReferenceId ] ; if ( mobile != null ) { mobile . SetChildren ( info , this ) ; } } foreach ( SerializationInfo info in deserialized ) { ISerializationNotification notifiable = _deserializationReferences [ info . ReferenceId ] as ISerializationNotification ; if ( notifiable != null ) notifiable . Deserialized ( ) ; } return ( _deserializationReferences . Count > 0 ? _deserializationReferences [ 1 ] : null ) ; }
Deserialize an object from DTO graph.
Deserialize an object from DTO graph .
None
deserialized
List<SerializationInfo>
DTO group to deserialize
DTO group to deserialize