コード例 #1
0
        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);
 }
コード例 #3
0
        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);
 }
コード例 #7
0
 public override string ToString()
 {
     return(MigrationXmlSerializer.Serialize(this));
 }