Index: /branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs	(revision 1361)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Core/DeSerializer.cs	(revision 1362)
@@ -75,14 +75,12 @@
 
     private readonly Dictionary<int, object> id2obj;
+    private readonly Dictionary<Type, object> serializerMapping;
     private readonly Dictionary<Type, Handler> handlers;
-    private readonly Stack<IAccessibleObject> parentStack;
-    private readonly Configuration configuration;
+    private readonly Stack<IAccessibleObject> parentStack;    
     private readonly Dictionary<int, Type> typeIds;    
     private List<Thunk> finalFixes;
 
     public DeSerializer(
-      IEnumerable<KeyValuePair<string, int>> typeCache,
-      Configuration configuration) {
-      this.configuration = configuration;
+      IEnumerable<TypeMapping> typeCache) {      
       id2obj = new Dictionary<int, object>();
       parentStack = new Stack<IAccessibleObject>();
@@ -95,7 +93,12 @@
                    };      
       typeIds = new Dictionary<int, Type>();
-      foreach ( var pair in typeCache ) {
-        Type type = Type.GetType(pair.Key);
-        typeIds.Add(pair.Value, type);
+      serializerMapping = new Dictionary<Type, object>();
+      foreach ( var typeMapping in typeCache ) {
+        Type type = Type.GetType(typeMapping.TypeName);
+        typeIds.Add(typeMapping.Id, type);
+        if (typeMapping.Serializer != null) {
+          Type serializerType = Type.GetType(typeMapping.Serializer);
+          serializerMapping.Add(type, Activator.CreateInstance(serializerType, true));
+        }
       }
     }
@@ -116,5 +119,8 @@
       object instance;      
       Type type = typeIds[(int)start.TypeId];
-      if (configuration.GetDecomposer(type) != null) {
+      IDecomposer decomposer = null;
+      if ( serializerMapping.ContainsKey(type) )
+        decomposer = serializerMapping[type] as IDecomposer;      
+      if (decomposer != null) {
         instance = new ParentReference();
         parentStack.Push(new CustomComposite(instance));        
@@ -132,5 +138,7 @@
       EndToken end = (EndToken)token;
       Type type = typeIds[(int)end.TypeId];
-      IDecomposer decomposer = configuration.GetDecomposer(type);
+      IDecomposer decomposer = null;
+      if (serializerMapping.ContainsKey(type))
+        decomposer = serializerMapping[type] as IDecomposer;            
       if (decomposer != null) {
         CustomComposite customComposite = (CustomComposite)parentStack.Pop();
@@ -150,7 +158,5 @@
       PrimitiveToken primitive = (PrimitiveToken)token;
       Type type = typeIds[(int)primitive.TypeId];
-      object value = configuration
-        .GetFormatter(type)
-        .Parse(primitive.SerialData);
+      object value = ((IFormatter) serializerMapping[type]).Parse(primitive.SerialData);
       if ( ! value.GetType().IsValueType )
         id2obj[(int)primitive.Id] = value;
@@ -172,5 +178,5 @@
       NullReferenceToken nil = (NullReferenceToken)token;
       SetValue(nil.Name, null);
-    }
+    }    
 
     private void SetValue(string name, object value) {
Index: /branches/New Persistence Exploration/Persistence/Persistence/Core/Serializer.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Core/Serializer.cs	(revision 1361)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Core/Serializer.cs	(revision 1362)
@@ -5,4 +5,21 @@
 
 namespace HeuristicLab.Persistence.Core {
+
+  public struct TypeMapping {
+    public readonly int Id;
+    public readonly string TypeName;
+    public readonly string Serializer;    
+    public TypeMapping(int id, string typeName, string serializer) {
+      Id = id;
+      TypeName = typeName;
+      Serializer = serializer;
+    }
+    public Dictionary<string, object> GetDict() {
+      return new Dictionary<string, object> {
+        {"id", Id},
+        {"typeName", TypeName},
+        {"serializer", Serializer}};                                            
+    }
+  }
 
   public class Serializer : IEnumerable<ISerializationToken> {
@@ -14,9 +31,19 @@
     private readonly Configuration configuration;
 
-    public Dictionary<string, int> TypeCache {
+    public List<TypeMapping> TypeCache {
       get {        
-        Dictionary<string, int> result = new Dictionary<string, int>();
-        foreach ( var pair in typeCache )
-          result.Add(pair.Key.AssemblyQualifiedName, pair.Value);
+        List<TypeMapping> result = new List<TypeMapping>();
+        foreach (var pair in typeCache) {
+          string serializer = null;
+          IFormatter f = configuration.GetFormatter(pair.Key);
+          if (f != null) {
+            serializer = f.GetType().AssemblyQualifiedName;
+          } else {
+            IDecomposer d = configuration.GetDecomposer(pair.Key);
+            if (d != null)
+              serializer = d.GetType().AssemblyQualifiedName;
+          }
+          result.Add(new TypeMapping(pair.Value, pair.Key.AssemblyQualifiedName, serializer));
+        }
         return result;                                     
       }
Index: /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlGenerator.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlGenerator.cs	(revision 1361)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlGenerator.cs	(revision 1362)
@@ -3,4 +3,5 @@
 using System.Text;
 using HeuristicLab.Persistence.Interfaces;
+using HeuristicLab.Persistence.Core;
 
 namespace HeuristicLab.Persistence.Default.Xml {
@@ -108,10 +109,8 @@
     }
 
-    public IEnumerable<string> Format(Dictionary<string, int> typeCache) {
+    public IEnumerable<string> Format(List<TypeMapping> typeCache) {
       yield return "<" + XmlStrings.TYPECACHE + ">";
-      foreach ( var pair in typeCache )
-        yield return FormatNode(XmlStrings.TYPE,
-                                new Dictionary<string, object> {{"id", pair.Value}, {"name", pair.Key}},
-                                NodeType.Inline);        
+      foreach (var mapping in typeCache)
+        yield return FormatNode(XmlStrings.TYPE, mapping.GetDict(), NodeType.Inline);                                
       yield return "</" + XmlStrings.TYPECACHE + ">";
     }
Index: /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlParser.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlParser.cs	(revision 1361)
+++ /branches/New Persistence Exploration/Persistence/Persistence/Default/Xml/XmlParser.cs	(revision 1362)
@@ -4,8 +4,8 @@
 using System.Collections;
 using System.IO;
+using HeuristicLab.Persistence.Core;
 using HeuristicLab.Persistence.Interfaces;
 
 namespace HeuristicLab.Persistence.Default.Xml {
-
 
   public class XmlParser : IEnumerable<ISerializationToken> {
@@ -91,11 +91,13 @@
     }
 
-    public static Dictionary<string, int> ParseTypeCache(TextReader reader) {
-      Dictionary<string, int> typeCache = new Dictionary<string, int>();
+    public static List<TypeMapping> ParseTypeCache(TextReader reader) {
+      var typeCache = new List<TypeMapping>();
       XmlReader xmlReader = XmlReader.Create(reader);
       while ( xmlReader.Read() ) {
-        if (xmlReader.Name == XmlStrings.TYPE) {          
-          typeCache.Add(xmlReader.GetAttribute("name")
-          , int.Parse(xmlReader.GetAttribute("id")));
+        if (xmlReader.Name == XmlStrings.TYPE) {
+          typeCache.Add(new TypeMapping(
+            int.Parse(xmlReader.GetAttribute("id")),
+            xmlReader.GetAttribute("typeName"),
+            xmlReader.GetAttribute("serializer")));
         }
       }
Index: /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs
===================================================================
--- /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1361)
+++ /branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs	(revision 1362)
@@ -172,6 +172,5 @@
       XmlParser parser = new XmlParser(new StreamReader("test.xml"));
       DeSerializer deSerializer = new DeSerializer(
-        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
-        ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance));        
+        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")));        
       object o = deSerializer.DeSerialize(parser);      
       Console.Out.WriteLine(Util.AutoFormat(o, true));      
@@ -192,6 +191,5 @@
       XmlParser parser = new XmlParser(new StreamReader("test2.xml"));
       DeSerializer deSerializer = new DeSerializer(
-        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
-        ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance));        
+        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")));        
       object o = deSerializer.DeSerialize(parser);      
       Console.Out.WriteLine(Util.AutoFormat(o, true));      
