public static T Deserialize <T>(string rawXml) where T : IXmlSerializable, new()
        {
            Util.ThrowOnNullOrEmptyArgument(rawXml, "rawXml");
            T t = (default(T) == null) ? Activator.CreateInstance <T>() : default(T);

            MigrationXmlSerializer.Deserialize(rawXml, new Action <XmlReader>(t.ReadXml));
            return(t);
        }
示例#2
0
 public MultiValuedProperty <string> GetMultiValuedStringProperty(string key)
 {
     if (this.Contains(key))
     {
         string required = this.GetRequired <string>(key);
         return((MultiValuedProperty <string>)MigrationXmlSerializer.Deserialize(required, typeof(MultiValuedProperty <string>)));
     }
     return(null);
 }
        public static object Deserialize(string rawXml, Type type)
        {
            Util.ThrowOnNullOrEmptyArgument(rawXml, "rawXml");
            Util.ThrowOnNullArgument(type, "type");
            object obj = null;

            MigrationXmlSerializer.Deserialize(rawXml, delegate(XmlReader xmlReader)
            {
                XmlSerializer xmlSerializer = new XmlSerializer(type);
                obj = xmlSerializer.Deserialize(xmlReader);
            });
            if (obj == null)
            {
                throw new MigrationDataCorruptionException("couldn't deserialize object of type " + type);
            }
            return(obj);
        }
示例#4
0
 public string Serialize()
 {
     return(MigrationXmlSerializer.Serialize(this));
 }
示例#5
0
 public static PersistableDictionary Create(string rawXml)
 {
     return(MigrationXmlSerializer.Deserialize <PersistableDictionary>(rawXml));
 }
示例#6
0
 public void SetMultiValuedProperty(string key, MultiValuedProperty <string> value)
 {
     this[key] = MigrationXmlSerializer.Serialize(value);
 }
 public override string ToString()
 {
     return(MigrationXmlSerializer.Serialize(this));
 }