Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1320 for branches


Ignore:
Timestamp:
03/09/09 17:25:27 (16 years ago)
Author:
epitzer
Message:

store actual type information instead of declared type. (#506)

Location:
branches/New Persistence Exploration/Persistence/Persistence
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Persistence/NewSerializationTest.cs

    r1318 r1320  
    4242  }
    4343
     44  public class Manager {
     45
     46    private DateTime lastLoadTime;
     47    [Storable]
     48    private DateTime lastLoadTimePersistence {
     49      get { return lastLoadTime; }
     50      set { this.lastLoadTime = DateTime.Now; }
     51    }
     52    [Storable]
     53    private Nullable<double> dbl = null;
     54  } 
     55
    4456  public class NewSerializationTest {
    45     public static void Main() {
     57
     58    public static void Test1() {
    4659      Root r = new Root();
    4760      r.selfReferences = new List<Root>();
     
    6578      DeSerializer deSerializer = new DeSerializer();       
    6679      object o = deSerializer.DeSerialize(parser);
     80      Console.Out.WriteLine(Util.AutoFormat(o, true));     
     81    }
     82
     83    public static void Test2() {
     84      Manager m = new Manager();     
     85      Serializer s = new Serializer(m);
     86      Persistence.XmlFormatter xmlFormatter = new Persistence.XmlFormatter();
     87      StreamWriter writer = new StreamWriter("test2.xml");
     88      foreach (ISerializationToken token in s) {
     89        string line = xmlFormatter.Format(token);
     90        writer.Write(line);
     91        Console.Out.Write(line);
     92      }
     93      writer.Close();
     94      XmlParser parser = new XmlParser(new StreamReader("test2.xml"));
     95      DeSerializer deSerializer = new DeSerializer();
     96      object o = deSerializer.DeSerialize(parser);
    6797      Console.Out.WriteLine(Util.AutoFormat(o, true));
     98    }
     99
     100    public static void Main() {
     101      //Test1();
     102      Test2();
    68103      Console.In.ReadLine();
    69104    }
  • branches/New Persistence Exploration/Persistence/Persistence/XmlFormatter.cs

    r1280 r1320  
    3131      string result =
    3232        String.Format("{0}<COMPOSITE name=\"{1}\" type=\"{2}\" id=\"{3}\">\n",
    33           this.Prefix, beginToken.Accessor.Name, beginToken.Accessor.Type, beginToken.Id);
     33          this.Prefix, beginToken.Accessor.Name, beginToken.Accessor.Get().GetType(), beginToken.Id);
    3434      this.depth += 1;
    3535      return result;
     
    4545      PrimitiveToken dataToken = (PrimitiveToken)token;
    4646      return String.Format("{0}<PRIMITIVE name=\"{1}\" type=\"{2}\">{3}</PRIMITIVE>\n",
    47         this.Prefix, dataToken.accessor.Name, dataToken.accessor.Type, dataToken.Data);
     47        this.Prefix, dataToken.accessor.Name, dataToken.accessor.Get().GetType(), dataToken.Data);
    4848    }
    4949
Note: See TracChangeset for help on using the changeset viewer.