Changeset 1278 for branches/New Persistence Exploration
- Timestamp:
- 03/06/09 17:18:22 (16 years ago)
- Location:
- branches/New Persistence Exploration/Persistence/Persistence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence/NewSerializationTest.cs
r1274 r1278 49 49 writer.Close(); 50 50 XmlParser parser = new XmlParser(new StreamReader("test.xml")); 51 DeSerializer deSerializer = new DeSerializer(); 51 DeSerializer deSerializer = new DeSerializer( 52 new IPrimitiveSerializer[] { new Int2XMLSerializer(), new String2XMLSerializer() }, 53 new ICustomSerializer[] { new ArraySerializer(), new EnumerableSerializer() }); 52 54 object o = deSerializer.DeSerialize(parser); 53 55 Console.Out.WriteLine(Util.AutoFormat(o, true)); -
branches/New Persistence Exploration/Persistence/Persistence/PersistenceManager.cs
r1276 r1278 270 270 private List<ICustomSerializer> customSerializers; 271 271 272 public DeSerializer() { 272 public DeSerializer( 273 IEnumerable<IPrimitiveSerializer> primitiveSerializers, 274 IEnumerable<ICustomSerializer> customSerializers) { 273 275 id2obj = new Dictionary<int, object>(); 274 276 compositeStack = new Stack<IAccessibleObject>(); … … 280 282 handlers.Add(typeof(Null), new Handler(NullHandler)); 281 283 // TODO: make this configurable 282 primitiveSerializers = new Dictionary<Type, IPrimitiveSerializer>();283 primitiveSerializers.Add(typeof(int), new Int2XMLSerializer());284 primitiveSerializers.Add(typeof(string), new String2XMLSerializer());285 customSerializers = new List<ICustomSerializer>();286 customSerializers.Add(new ArraySerializer());287 customSerializers.Add(new EnumerableSerializer());284 this.primitiveSerializers = new Dictionary<Type, IPrimitiveSerializer>(); 285 foreach (IPrimitiveSerializer ps in primitiveSerializers) { 286 this.primitiveSerializers.Add(ps.Type, ps); 287 } 288 this.customSerializers = new List<ICustomSerializer>(customSerializers); 289 288 290 } 289 291 public object DeSerialize(IEnumerable<IParseToken> tokens) {
Note: See TracChangeset
for help on using the changeset viewer.