Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Index.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Index.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Index.cs	(revision 15509)
@@ -26,6 +26,6 @@
   [NonDiscoverableType]
   internal sealed class Index<T> where T : class {
-    private Dictionary<T, uint> indexes;
-    private Dictionary<uint, T> values;
+    private readonly Dictionary<T, uint> indexes;
+    private readonly Dictionary<uint, T> values;
     private uint nextIndex;
 
@@ -35,6 +35,6 @@
       nextIndex = 1;
     }
-    public Index(IEnumerable<T> values)
-      : this() {
+
+    public Index(IEnumerable<T> values) : this() {
       foreach (var value in values) {
         this.indexes.Add(value, nextIndex);
@@ -54,7 +54,9 @@
       return index;
     }
+
     public T GetValue(uint index) {
       return index == 0 ? null : values[index];
     }
+
     public IEnumerable<T> GetValues() {
       return values.Values;
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Mapper.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Mapper.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/Mapper.cs	(revision 15509)
@@ -23,5 +23,5 @@
 using System.Collections.Generic;
 using System.Linq;
-using Google.ProtocolBuffers;
+using Google.Protobuf;
 
 namespace HeuristicLab.Persistence {
@@ -43,5 +43,5 @@
     }
 
-    private static StaticCache staticCache = null;
+    private static StaticCache staticCache;
     private static object locker = new object();
     public static StaticCache StaticCache {
@@ -56,46 +56,72 @@
     private Index<ITransformer> transformers;
     private Index<Type> types;
-    private Index<string> strings;
+
     private Dictionary<uint, Box> boxId2Box;
     private Dictionary<object, uint> object2BoxId;
-    private Dictionary<uint, object> boxId2object;
+    private Dictionary<uint, object> boxId2Object;
+    private Index<TypeBox> typeBoxes;
+
+    private Index<string> strings;
+
+    private Index<BoolArrayBox> boolArrayBoxes;
+    private Index<IntArrayBox> intArrayBoxes;
+    private Index<UnsignedIntArrayBox> unsignedIntArrayBoxes;
+    private Index<LongArrayBox> longArrayBoxes;
+    private Index<UnsignedLongArrayBox> unsignedLongArrayBoxes;
+    private Index<FloatArrayBox> floatArrayBoxes;
+    private Index<DoubleArrayBox> doubleArrayBoxes;
+
+    private Index<DictionaryBox> dictionaryBoxes;
+    private Index<StorableClassBox> storableClassBoxes;
 
     public uint BoxCount { get; private set; }
+
 
     public Mapper() {
       transformers = new Index<ITransformer>();
       types = new Index<Type>();
-      strings = new Index<string>();
+
       boxId2Box = new Dictionary<uint, Box>();
       object2BoxId = new Dictionary<object, uint>(new MappingEqualityComparer());
-      boxId2object = new Dictionary<uint, object>();
+      boxId2Object = new Dictionary<uint, object>();
+      typeBoxes = new Index<TypeBox>();
+
+      strings = new Index<string>();
+
+      boolArrayBoxes = new Index<BoolArrayBox>();
+      intArrayBoxes = new Index<IntArrayBox>();
+      unsignedIntArrayBoxes = new Index<UnsignedIntArrayBox>();
+      longArrayBoxes = new Index<LongArrayBox>();
+      unsignedLongArrayBoxes = new Index<UnsignedLongArrayBox>();
+      floatArrayBoxes = new Index<FloatArrayBox>();
+      doubleArrayBoxes = new Index<DoubleArrayBox>();
+
+      dictionaryBoxes = new Index<DictionaryBox>();
+      storableClassBoxes = new Index<StorableClassBox>();
 
       BoxCount = 0;
     }
 
+    #region Transformers
     public uint GetTransformerId(ITransformer transformer) {
       return transformers.GetIndex(transformer);
     }
+
     public ITransformer GetTransformer(uint transformerId) {
       return transformers.GetValue(transformerId);
     }
-
+    #endregion
+
+    #region Types
     public uint GetTypeId(Type type) {
       return types.GetIndex(type);
     }
+
     public Type GetType(uint typeId) {
       return types.GetValue(typeId);
     }
-
-    public uint GetStringId(string str) {
-      return strings.GetIndex(str);
-    }
-    public string GetString(uint stringId) {
-      return strings.GetValue(stringId);
-    }
-
-    public Box GetBox(uint boxId) {
-      return boxId2Box[boxId];
-    }
+    #endregion
+
+    #region Boxes
     public uint GetBoxId(object o) {
       uint boxId;
@@ -115,7 +141,12 @@
       return boxId;
     }
+
+    public Box GetBox(uint boxId) {
+      return boxId2Box[boxId];
+    }
+
     public object GetObject(uint boxId) {
       object o;
-      if (boxId2object.TryGetValue(boxId, out o)) return o;
+      if (boxId2Object.TryGetValue(boxId, out o)) return o;
 
       Box box;
@@ -127,9 +158,72 @@
         var transformer = transformers.GetValue(box.TransformerId);
         o = transformer.ToObject(box, this);
-        boxId2object.Add(boxId, o);
+        boxId2Object.Add(boxId, o);
         transformer.FillFromBox(o, box, this);
       }
+
       return o;
     }
+
+    #region Referenced Boxes
+    #region TypeBoxes
+    public uint GetTypeBoxId(TypeBox typeBox) { return typeBoxes.GetIndex(typeBox); }
+    public TypeBox GetTypeBox(uint typeBoxId) { return typeBoxes.GetValue(typeBoxId); }
+    #endregion
+
+    #region BoolArrayBox
+    public uint GetBoolArrayBoxId(BoolArrayBox boolArrayBox) { return boolArrayBoxes.GetIndex(boolArrayBox); }
+    public BoolArrayBox GetBoolArrayBox(uint boolArrayBoxId) { return boolArrayBoxes.GetValue(boolArrayBoxId); }
+    #endregion
+
+    #region IntArrayBox
+    public uint GetIntArrayBoxId(IntArrayBox intArrayBox) { return intArrayBoxes.GetIndex(intArrayBox); }
+    public IntArrayBox GetIntArrayBox(uint intArrayBoxId) { return intArrayBoxes.GetValue(intArrayBoxId); }
+    #endregion
+
+    #region UnsignedIntArrayBox
+    public uint GetUnsignedIntArrayBoxId(UnsignedIntArrayBox unsignedIntArrayBox) { return unsignedIntArrayBoxes.GetIndex(unsignedIntArrayBox); }
+    public UnsignedIntArrayBox GetUnsignedIntArrayBox(uint unsignedIntArrayBoxId) { return unsignedIntArrayBoxes.GetValue(unsignedIntArrayBoxId); }
+    #endregion
+
+    #region LongArrayBox
+    public uint GetLongArrayBoxId(LongArrayBox longArrayBox) { return longArrayBoxes.GetIndex(longArrayBox); }
+    public LongArrayBox GetLongArrayBox(uint longArrayBoxId) { return longArrayBoxes.GetValue(longArrayBoxId); }
+    #endregion
+
+    #region UnsignedLongArrayBox
+    public uint GetUnsignedLongArrayBoxId(UnsignedLongArrayBox unsignedLongArrayBox) { return unsignedLongArrayBoxes.GetIndex(unsignedLongArrayBox); }
+    public UnsignedLongArrayBox GetUnsignedLongArrayBox(uint unsignedLongArrayBoxId) { return unsignedLongArrayBoxes.GetValue(unsignedLongArrayBoxId); }
+    #endregion
+
+    #region FloatArrayBox
+    public uint GetFloatArrayBoxId(FloatArrayBox floatArrayBox) { return floatArrayBoxes.GetIndex(floatArrayBox); }
+    public FloatArrayBox GetFloatArrayBox(uint floatArrayBoxId) { return floatArrayBoxes.GetValue(floatArrayBoxId); }
+    #endregion
+
+    #region DoubleArrayBox
+    public uint GetDoubleArrayBoxId(DoubleArrayBox doubleArrayBox) { return doubleArrayBoxes.GetIndex(doubleArrayBox); }
+    public DoubleArrayBox GetDoubleArrayBox(uint doubleArrayBoxId) { return doubleArrayBoxes.GetValue(doubleArrayBoxId); }
+    #endregion
+
+    #region DictionaryBox
+    public uint GetDictionaryBoxId(DictionaryBox dictionaryBox) { return dictionaryBoxes.GetIndex(dictionaryBox); }
+    public DictionaryBox GetDictionaryBox(uint dictionaryBoxId) { return dictionaryBoxes.GetValue(dictionaryBoxId); }
+    #endregion
+
+    #region StorableClassBox
+    public uint GetStorableClassBoxId(StorableClassBox storableClassBox) { return storableClassBoxes.GetIndex(storableClassBox); }
+    public StorableClassBox GetStorableClassBox(uint storableClassBoxId) { return storableClassBoxes.GetValue(storableClassBoxId); }
+    #endregion
+    #endregion
+    #endregion
+
+    #region Strings
+    public uint GetStringId(string str) {
+      return strings.GetIndex(str);
+    }
+    public string GetString(uint stringId) {
+      return strings.GetValue(stringId);
+    }
+    #endregion
 
     public object CreateInstance(Type type) {
@@ -143,18 +237,49 @@
     public static Bundle ToBundle(object o) {
       var mapper = new Mapper();
-      var bundle = Bundle.CreateBuilder();
+      var bundle = new Bundle();
+
       bundle.RootBoxId = mapper.GetBoxId(o);
-      bundle.AddRangeTransformerGuids(mapper.transformers.GetValues().Select(x => x.Guid).Select(x => ByteString.CopyFrom(x.ToByteArray())));
-      bundle.AddRangeTypeGuids(mapper.types.GetValues().Select(x => ByteString.CopyFrom(StaticCache.GetGuid(x).ToByteArray())));
-      bundle.AddRangeStrings(mapper.strings.GetValues());
-      bundle.AddRangeBoxes(mapper.boxId2Box.OrderBy(x => x.Key).Select(x => x.Value));
-      return bundle.Build();
+      bundle.TransformerGuids.AddRange(mapper.transformers.GetValues().Select(x => x.Guid).Select(x => ByteString.CopyFrom(x.ToByteArray())));
+      bundle.TypeGuids.AddRange(mapper.types.GetValues().Select(x => ByteString.CopyFrom(StaticCache.GetGuid(x).ToByteArray())));
+      bundle.Boxes.AddRange(mapper.boxId2Box.OrderBy(x => x.Key).Select(x => x.Value));
+      bundle.TypeBoxes.AddRange(mapper.typeBoxes.GetValues());
+
+      bundle.Strings.AddRange(mapper.strings.GetValues());
+
+      bundle.BoolArrayBoxes.AddRange(mapper.boolArrayBoxes.GetValues());
+      bundle.IntArrayBoxes.AddRange(mapper.intArrayBoxes.GetValues());
+      bundle.UnsignedIntArrayBoxes.AddRange(mapper.unsignedIntArrayBoxes.GetValues());
+      bundle.LongArrayBoxes.AddRange(mapper.longArrayBoxes.GetValues());
+      bundle.UnsignedLongArrayBoxes.AddRange(mapper.unsignedLongArrayBoxes.GetValues());
+      bundle.FloatArrayBoxes.AddRange(mapper.floatArrayBoxes.GetValues());
+      bundle.DoubleArrayBoxes.AddRange(mapper.doubleArrayBoxes.GetValues());
+
+      bundle.DictionaryBoxes.AddRange(mapper.dictionaryBoxes.GetValues());
+      bundle.StorableClassBoxes.AddRange(mapper.storableClassBoxes.GetValues());
+
+      return bundle;
     }
     public static object ToObject(Bundle bundle) {
       var mapper = new Mapper();
-      mapper.types = new Index<Type>(bundle.TypeGuidsList.Select(x => StaticCache.GetType(new Guid(x.ToByteArray()))));
-      mapper.strings = new Index<string>(bundle.StringsList);
-      mapper.boxId2Box = bundle.BoxesList.Select((b, i) => new { Box = b, Index = i }).ToDictionary(k => (uint)k.Index + 1, v => v.Box);
-      mapper.transformers = new Index<ITransformer>(bundle.TransformerGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => StaticCache.GetTransformer(x)));
+
+      mapper.transformers = new Index<ITransformer>(bundle.TransformerGuids.Select(x => new Guid(x.ToByteArray())).Select(StaticCache.GetTransformer));
+      mapper.types = new Index<Type>(bundle.TypeGuids.Select(x => StaticCache.GetType(new Guid(x.ToByteArray()))));
+
+      mapper.boxId2Box = bundle.Boxes.Select((b, i) => new { Box = b, Index = i }).ToDictionary(k => (uint)k.Index + 1, v => v.Box);
+      mapper.typeBoxes = new Index<TypeBox>(bundle.TypeBoxes);
+
+      mapper.strings = new Index<string>(bundle.Strings);
+
+      mapper.boolArrayBoxes = new Index<BoolArrayBox>(bundle.BoolArrayBoxes);
+      mapper.intArrayBoxes = new Index<IntArrayBox>(bundle.IntArrayBoxes);
+      mapper.unsignedIntArrayBoxes = new Index<UnsignedIntArrayBox>(bundle.UnsignedIntArrayBoxes);
+      mapper.longArrayBoxes = new Index<LongArrayBox>(bundle.LongArrayBoxes);
+      mapper.unsignedLongArrayBoxes = new Index<UnsignedLongArrayBox>(bundle.UnsignedLongArrayBoxes);
+      mapper.floatArrayBoxes = new Index<FloatArrayBox>(bundle.FloatArrayBoxes);
+      mapper.doubleArrayBoxes = new Index<DoubleArrayBox>(bundle.DoubleArrayBoxes);
+
+      mapper.dictionaryBoxes = new Index<DictionaryBox>(bundle.DictionaryBoxes);
+      mapper.storableClassBoxes = new Index<StorableClassBox>(bundle.StorableClassBoxes);
+
       return mapper.GetObject(bundle.RootBoxId);
     }
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/ProtoBufSerializer.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/ProtoBufSerializer.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/ProtoBufSerializer.cs	(revision 15509)
@@ -21,13 +21,16 @@
 
 using System.IO;
+using Google.Protobuf;
 
 namespace HeuristicLab.Persistence {
   public sealed class ProtoBufSerializer : Serializer {
     protected override void SerializeBundle(Bundle bundle, Stream stream) {
-      bundle.WriteTo(stream);
+      using (var outputStream = new CodedOutputStream(stream))
+        bundle.WriteTo(outputStream);
     }
 
     protected override Bundle DeserializeBundle(Stream stream) {
-      return Bundle.ParseFrom(stream, Mapper.StaticCache.GetExtensionRegistry());
+      using (var inputStream = new CodedInputStream(stream))
+        return Bundle.Parser.ParseFrom(inputStream);
     }
   }
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/StaticCache.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/StaticCache.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Core/StaticCache.cs	(revision 15509)
@@ -25,17 +25,15 @@
 using System.Drawing;
 using System.Linq;
-using Google.ProtocolBuffers;
 using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Persistence {
   public sealed class StaticCache {
-    private static object locker = new object();
+    private static readonly object locker = new object();
 
-    private Dictionary<Guid, ITransformer> guid2Transformer;
-    private Dictionary<ITransformer, Guid> transformer2Guid;
-    private Dictionary<Guid, Type> guid2Type;
-    private Dictionary<Type, Guid> type2Guid;
-    private Dictionary<Type, TypeInfo> typeInfos;
-    private ExtensionRegistry extensionRegistry;
+    private readonly Dictionary<Guid, ITransformer> guid2Transformer;
+    private readonly Dictionary<ITransformer, Guid> transformer2Guid;
+    private readonly Dictionary<Guid, Type> guid2Type;
+    private readonly Dictionary<Type, Guid> type2Guid;
+    private readonly Dictionary<Type, TypeInfo> typeInfos;
 
     internal StaticCache() {
@@ -45,5 +43,4 @@
       type2Guid = new Dictionary<Type, Guid>();
       typeInfos = new Dictionary<Type, TypeInfo>();
-      extensionRegistry = ExtensionRegistry.CreateInstance();
 
       foreach (var transformer in ApplicationManager.Manager.GetInstances<ITransformer>())
@@ -82,23 +79,9 @@
       RegisterType(new Guid("E84C326A-7E14-4F28-AEFF-BC16CC671655"), typeof(KeyValuePair<,>));
       RegisterType(new Guid("F0280B55-25E8-4981-B309-D675D081402A"), typeof(string));
-      // 
+
       RegisterType(new Guid("9CF55419-439B-4A90-B2ED-8C7F7768EB61"), typeof(Array));
-      // RegisterType(new Guid("D15AD28B-203A-460E-815C-F7230C4B1F75"), typeof(bool[]));
-      // RegisterType(new Guid("EE318DC4-580D-4DB1-9AAD-988B0E50A3DB"), typeof(byte[]));
-      // RegisterType(new Guid("326B9484-361F-46F8-B8A6-46C781A8C51F"), typeof(sbyte[]));
-      // RegisterType(new Guid("C854783D-4C91-43C8-A19A-F96012494F8A"), typeof(short[]));
-      // RegisterType(new Guid("C47FB329-2A1D-4EB7-AFB1-1CF72AB30E98"), typeof(ushort[]));
-      // RegisterType(new Guid("9681D044-B50C-4907-B23E-BDFEBC6C3FFC"), typeof(char[]));
-      // RegisterType(new Guid("0FC62D91-D63F-4507-8696-885D4C07285A"), typeof(int[]));
-      // RegisterType(new Guid("C43A25A0-9B99-4DA4-9279-7495FE10428E"), typeof(uint[]));
-      // RegisterType(new Guid("7AC4DDAC-0E13-428E-BF49-7BE7B76746CB"), typeof(long[]));
-      // RegisterType(new Guid("8D9283A7-FE49-4AEA-A09F-D53CF3BE520A"), typeof(ulong[]));
-      // RegisterType(new Guid("BB9CFA0B-DD29-4C44-85C6-3A6289C55448"), typeof(float[]));
-      // RegisterType(new Guid("3B3AA69E-1641-4202-AE1D-7EEFF60FA355"), typeof(double[]));
-      // RegisterType(new Guid("7DF325A6-2553-4915-B7C6-D98191107CB7"), typeof(string[]));
-
-      RegisterType(new Guid("E451A99B-0CFD-48E6-9BEF-0AE9D1E73628"), typeof(IList));
       RegisterType(new Guid("B7313EE2-045F-41C9-AEC9-7B1A8CDBF90F"), typeof(IEnumerable));
       RegisterType(new Guid("D5265599-7380-4A28-AB0D-9F336EF290C5"), typeof(IEnumerable<>));
+      RegisterType(new Guid("E451A99B-0CFD-48E6-9BEF-0AE9D1E73628"), typeof(IList));
       RegisterType(new Guid("DB2A785C-5803-42C7-A01F-E1FD845A83A1"), typeof(List<>));
       RegisterType(new Guid("EB98A564-BEDC-458A-9E9B-4BF3CDAFB9BE"), typeof(Stack<>));
@@ -129,4 +112,5 @@
         }
       }
+
       RegisterType(new Guid("67C35B3B-DC23-4929-9BA9-0A0CD5FE17F5"), allTypes["System.StringComparer"]);
       RegisterType(new Guid("C7FDE8F0-EF3F-4A4D-8D87-5559C32A8B90"), allTypes["System.CultureAwareComparer"]);
@@ -151,46 +135,5 @@
       RegisterType(new Guid("00C8C940-63D9-43FF-99BA-9C69301BF043"), allTypes["System.Collections.Generic.RandomizedObjectEqualityComparer"]);
       RegisterType(new Guid("DAF22757-7FCC-49AC-B148-F3DD7E9E0A3B"), allTypes["System.Collections.Generic.IEqualityComparer`1"]);
-
-      //var registeredTypes = type2Guid.Keys.ToArray();
-      //foreach (var t in registeredTypes) {
-      //  AddBaseTypesRec(t);
-      //}
-
-      RegisterExtension(BoolBox.Bool);
-      RegisterExtension(IntBox.Int);
-      RegisterExtension(LongBox.Long);
-      RegisterExtension(UnsignedIntBox.UnsignedInt);
-      RegisterExtension(UnsignedLongBox.UnsignedLong);
-      RegisterExtension(FloatBox.Float);
-      RegisterExtension(DoubleBox.Double);
-      RegisterExtension(StringBox.String);
-      RegisterExtension(BytesBox.Bytes);
-      RegisterExtension(BoolArrayBox.BoolArray);
-      RegisterExtension(ByteArrayBox.ByteArray);
-      RegisterExtension(IntArrayBox.IntArray);
-      RegisterExtension(LongArrayBox.LongArray);
-      RegisterExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      RegisterExtension(UnsignedLongArrayBox.UnsignedLongArray);
-      RegisterExtension(FloatArrayBox.FloatArray);
-      RegisterExtension(DoubleArrayBox.DoubleArray);
-      RegisterExtension(StringArrayBox.StringArray);
-      RegisterExtension(MatrixBox.Matrix);
-      RegisterExtension(BoolMatrixBox.BoolMatrix);
-      RegisterExtension(IntMatrixBox.IntMatrix);
-      RegisterExtension(DictionaryBox.Dictionary);
-      RegisterExtension(StorableClassBox.StorableClass);
-      RegisterExtension(TypeBox.Type);
     }
-
-    //private void AddBaseTypesRec(MemberSelection t) {
-    //  foreach (var interfaceType in t.GetInterfaces()) {
-    //    RegisterTypeAndFullName(interfaceType);
-    //    AddBaseTypesRec(interfaceType);
-    //  }
-    //  if (t.BaseType != null) {
-    //    RegisterTypeAndFullName(t.BaseType);
-    //    AddBaseTypesRec(t.BaseType);
-    //  }
-    //}
 
     public void RegisterTransformer(ITransformer transformer) {
@@ -206,4 +149,5 @@
       }
     }
+
     // mainly for testing
     public void DeregisterType(Guid guid) {
@@ -213,31 +157,21 @@
       }
     }
-    //public void RegisterTypeAndFullName(MemberSelection type) {
-    //  lock (locker) {
-    //    var key = type.AssemblyQualifiedName ?? type.Name;
-    //    if (!guid2Type.ContainsKey(key)) {
-    //      guid2Type.Add(key, type);
-    //      type2Guid.Add(type, key);
-    //    }
-    //  }
-    //}
-    public void RegisterExtension<TExtension>(GeneratedExtensionBase<TExtension> extension) {
-      lock (locker) {
-        extensionRegistry.Add(extension);
-      }
-    }
 
     public ITransformer GetTransformer(Guid guid) {
       return guid2Transformer[guid];
     }
+
     public Guid GetGuid(ITransformer transformer) {
       return transformer2Guid[transformer];
     }
+
     public Type GetType(Guid guid) {
       return guid2Type[guid];
     }
+
     public Guid GetGuid(Type type) {
       return type2Guid[type];
     }
+
     public TypeInfo GetTypeInfo(Type type) {
       lock (locker) {
@@ -245,5 +179,5 @@
         if (!typeInfos.TryGetValue(type, out typeInfo)) {
           var transformer = guid2Transformer.Values.OrderBy(x => x.Priority).FirstOrDefault(x => x.CanTransformType(type));
-          if(transformer == null) throw new PersistenceException("No transformer found for type " + type.AssemblyQualifiedName);
+          if (transformer == null) throw new PersistenceException("No transformer found for type " + type.AssemblyQualifiedName);
           typeInfo = new TypeInfo(type, transformer);
           typeInfos.Add(type, typeInfo);
@@ -252,7 +186,4 @@
       }
     }
-    public ExtensionRegistry GetExtensionRegistry() {
-      return extensionRegistry;
-    }
   }
 }
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj	(revision 15509)
@@ -73,5 +73,4 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Protos\PersistenceMessages.cs" />
-    <Compile Include="Transformers\StorableClassTransformer.cs" />
     <Compile Include="Transformers\Transformers.cs" />
   </ItemGroup>
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Protos/PersistenceMessages.proto
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Protos/PersistenceMessages.proto	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Protos/PersistenceMessages.proto	(revision 15509)
@@ -9,31 +9,18 @@
   uint32 root_box_id = 10;
   repeated Box boxes = 20;
+  repeated TypeBox type_boxes = 30;
 
   repeated string strings = 100;
-  repeated bool bools = 101;
-  repeated int32 ints = 102;
-  repeated int64 longs = 103;
-  repeated uint32 uints = 104;
-  repeated uint64 ulongs = 105;
-  repeated float floats = 106;
-  repeated double doubles = 107;
-  repeated bytes bytes = 108;
 
-  repeated StringArrayBox string_arrays = 200;
-  repeated BoolArrayBox bool_arrays = 201;
-  repeated IntArrayBox int_arrays = 202;
-  repeated LongArrayBox long_arrays = 203;
-  repeated UnsignedIntArrayBox uint_arrays = 204;
-  repeated UnsignedLongArrayBox ulong_arrays = 205;
-  repeated FloatArrayBox float_arrays = 206;
-  repeated DoubleArrayBox double_arrays = 207;
-  repeated ByteArrayBox byte_arrays = 208;
-
-  repeated MatrixBox matrices = 300;
-  repeated BoolMatrixBox bool_matrices = 310;
-  repeated IntMatrixBox int_matrices = 311;
-
-  repeated DictionaryBox dictionaries = 400;
-  repeated StorableClassBox storables = 410;
+  repeated BoolArrayBox bool_array_boxes = 200;
+  repeated IntArrayBox int_array_boxes = 201;
+  repeated UnsignedIntArrayBox unsigned_int_array_boxes = 203;
+  repeated LongArrayBox long_array_boxes = 202;
+  repeated UnsignedLongArrayBox unsigned_long_array_boxes = 204;
+  repeated FloatArrayBox float_array_boxes = 205;
+  repeated DoubleArrayBox double_array_boxes = 206;
+  
+  repeated DictionaryBox dictionary_boxes = 300;
+  repeated StorableClassBox storable_class_boxes = 310;
 }
 message Box {
@@ -41,11 +28,13 @@
   uint32 type_id = 2;
   uint32 box_id = 3;
+
   bool bool = 10;
   int32 int = 11;
   int64 long = 12;
-  uint32 uint = 13;
-  uint64 ulong = 14;
+  uint32 u_int = 13;
+  uint64 u_long = 14;
   float float = 15;
   double double = 16;
+  bytes bytes = 17;
 }
 message TypeBox {
@@ -63,5 +52,4 @@
 message FloatArrayBox { repeated float values = 1; }
 message DoubleArrayBox { repeated double values = 1; }
-message ByteArrayBox { bytes values = 1; }
 
 // matrix boxes
Index: anches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/StorableClassTransformer.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/StorableClassTransformer.cs	(revision 15508)
+++ 	(revision )
@@ -1,153 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace HeuristicLab.Persistence {
-  [Transformer("78556C88-0FEE-4602-95C7-A469B2DDB468", 100)]
-  [StorableType("3a578289-43ca-40f8-9f1e-2bdd255cb8fb")]
-  internal sealed class StorableClassBoxTransformer : BoxTransformer<object> {
-    public override bool CanTransformType(Type type) {
-      return StorableTypeAttribute.IsStorableType(type) && !type.IsValueType && !type.IsEnum || // don't transform structs or enums
-        type.BaseType != null && CanTransformType(type.BaseType);
-    }
-
-    protected override void Populate(Box.Builder box, object value, Mapper mapper) {
-      var b = StorableClassBox.CreateBuilder();
-      var type = value.GetType();
-      var typeInfo = Mapper.StaticCache.GetTypeInfo(type);
-
-      var emptyArgs = new object[0];
-      foreach (var hook in typeInfo.BeforeSerializationHooks) {
-        hook.Invoke(value, emptyArgs);
-      }
-
-      var components = new Dictionary<uint, uint>();
-      foreach (var componentInfo in typeInfo.Fields) {
-        var field = (FieldInfo)componentInfo.MemberInfo;
-        var component = mapper.GetBoxId(field.GetValue(value));
-        components.Add(mapper.GetStringId(componentInfo.Name), component);
-      }
-
-      foreach (var componentInfo in typeInfo.Properties.Where(x => x.Readable)) {
-        var property = (PropertyInfo)componentInfo.MemberInfo;
-        var component = mapper.GetBoxId(property.GetValue(value, null));
-        components.Add(mapper.GetStringId(componentInfo.Name), component);
-      }
-
-      b.AddRangeKeyIds(components.Keys);
-      b.AddRangeValueIds(components.Values);
-
-      box.SetExtension(StorableClassBox.StorableClass, b.Build());
-    }
-
-    protected override object Extract(Box box, Type type, Mapper mapper) {
-      return mapper.CreateInstance(type);
-    }
-    public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var data = box.GetExtension(StorableClassBox.StorableClass);
-      var type = obj.GetType();
-      var typeInfo = Mapper.StaticCache.GetTypeInfo(type);
-      var typeBox = mapper.GetBox(box.TypeId).GetExtension(TypeBox.Type);
-      var version = typeBox.HasVersion ? typeBox.Version : 1;
-      var typeGuid = typeInfo.StorableTypeAttribute.Guid;
-
-      var components = new Dictionary<uint, uint>();
-      for (int i = 0; i < data.KeyIdsList.Count; i++) {
-        components.Add(data.KeyIdsList[i], data.ValueIdsList[i]);
-      }
-
-      var conversionMethods =
-        type.Assembly.GetTypes().SelectMany(t =>
-          t.GetMethods(BindingFlags.NonPublic | BindingFlags.Static)
-          .Where(StorableConversionAttribute.IsStorableConversionMethod)
-          .Where(mi => StorableConversionAttribute.GetGuid(mi) == typeGuid &&
-                       StorableConversionAttribute.GetVersion(mi) >= version))
-          .OrderBy(StorableConversionAttribute.GetVersion)
-          .ToArray();
-
-      // put all objects into dictionary for conversion 
-      var dict = new Dictionary<string, object>();
-      foreach (var component in components) {
-        dict.Add(mapper.GetString(component.Key), mapper.GetObject(component.Value));
-      }
-
-      Dictionary<string, object> lastDict = new Dictionary<string, object>();
-      foreach (var convMeth in conversionMethods) {
-        if (StorableConversionAttribute.GetVersion(convMeth) != version)
-          throw new PersistenceException(string.Format("No conversion method defined for type {0} version {1}", typeGuid, version));
-        lastDict = (Dictionary<string, object>)convMeth.Invoke(null, new object[] { dict });
-        foreach (var kvp in lastDict) {
-          dict[kvp.Key] = kvp.Value;
-        }
-        version++;
-      }
-      if (version != typeInfo.StorableTypeAttribute.Version)
-        throw new PersistenceException(string.Format("Missing one or more conversion methods for type {0} version {1}",
-          typeGuid, typeInfo.StorableTypeAttribute.Version));
-
-      // set default values for all fields and properties
-      foreach (var componentInfo in typeInfo.Fields) {
-        var field = (FieldInfo)componentInfo.MemberInfo;
-        if (componentInfo.StorableAttribute != null && componentInfo.StorableAttribute.DefaultValue != null)
-          field.SetValue(obj, componentInfo.StorableAttribute.DefaultValue);
-      }
-      foreach (var componentInfo in typeInfo.Properties.Where(x => x.Writeable)) {
-        var property = (PropertyInfo)componentInfo.MemberInfo;
-        if (componentInfo.StorableAttribute != null && componentInfo.StorableAttribute.DefaultValue != null)
-          property.SetValue(obj, componentInfo.StorableAttribute.DefaultValue, null);
-      }
-
-      // set all members as generated by conversion method chain
-      foreach (var kvp in dict) {
-        var key = kvp.Key;
-        var val = kvp.Value;
-        var fieldInfo = typeInfo.Fields.FirstOrDefault(fi => fi.Name == key);
-        if (fieldInfo != null) {
-          var field = (FieldInfo)fieldInfo.MemberInfo;
-          field.SetValue(obj, val);
-          lastDict.Remove(fieldInfo.Name); // only for consistency check
-          continue;
-        }
-        var propInfo = typeInfo.Properties.Where(x => x.Writeable).FirstOrDefault(pi => pi.Name == key);
-        if (propInfo != null) {
-          var prop = (PropertyInfo)propInfo.MemberInfo;
-          prop.SetValue(obj, val, null);
-          lastDict.Remove(propInfo.Name);    // only for consistency check
-          continue;
-        }
-      }
-
-      if (lastDict.Any())
-        throw new PersistenceException(string.Format("Invalid conversion method. The following members are undefined in type {0} version {1}: {2}",
-          typeGuid, typeInfo.StorableTypeAttribute.Version,
-          string.Join(", ", lastDict.Keys)));
-
-      var emptyArgs = new object[0];
-      foreach (var hook in typeInfo.AfterDeserializationHooks) {
-        hook.Invoke(obj, emptyArgs);
-      }
-    }
-  }
-}
Index: /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs	(revision 15509)
@@ -23,5 +23,4 @@
 using System.Collections;
 using System.Collections.Generic;
-using System.ComponentModel;
 using System.Drawing;
 using System.Drawing.Imaging;
@@ -30,5 +29,5 @@
 using System.Linq;
 using System.Reflection;
-using Google.ProtocolBuffers;
+using Google.Protobuf;
 
 namespace HeuristicLab.Persistence {
@@ -40,278 +39,45 @@
 
     public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      box.TypeId = mapper.GetBoxId(o.GetType());
+      var box = new Box {
+        TransformerId = mapper.GetTransformerId(this),
+        TypeId = mapper.GetBoxId(o.GetType())
+      };
       Populate(box, (T)o, mapper);
-      return box.Build();
-    }
+      return box;
+    }
+
     public override object ToObject(Box box, Mapper mapper) {
       return Extract(box, (Type)mapper.GetObject(box.TypeId), mapper);
     }
-    protected abstract void Populate(Box.Builder box, T value, Mapper mapper);
+
+    protected abstract void Populate(Box box, T value, Mapper mapper);
     protected abstract T Extract(Box box, Type type, Mapper mapper);
   }
 
-  #region Scalar Box Transformers
-  [StorableType("4b800c20-e93d-4186-9ccc-9e8081c028bb")]
-  public abstract class BoolBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = BoolBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<BoolBox>(BoolBox.Bool, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(BoolBox.Bool).Value, type, mapper);
-    }
-    protected abstract bool ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(bool value, Type type, Mapper mapper);
-  }
-  [StorableType("72b92810-3eee-4a35-b87a-0a9b06b58945")]
-  public abstract class IntBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = IntBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<IntBox>(IntBox.Int, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(IntBox.Int).Value, type, mapper);
-    }
-    protected abstract int ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(int value, Type type, Mapper mapper);
-  }
-  [StorableType("e7344a71-276d-4fc7-9d80-1f0a8b10dde5")]
-  public abstract class LongBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = LongBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<LongBox>(LongBox.Long, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(LongBox.Long).Value, type, mapper);
-    }
-    protected abstract long ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(long value, Type type, Mapper mapper);
-  }
-  [StorableType("76833301-5d1d-436d-86f6-6cfe1830405e")]
-  public abstract class UnsignedIntBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = UnsignedIntBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<UnsignedIntBox>(UnsignedIntBox.UnsignedInt, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(UnsignedIntBox.UnsignedInt).Value, type, mapper);
-    }
-    protected abstract uint ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(uint value, Type type, Mapper mapper);
-  }
-  [StorableType("4eb19b56-7ac7-497c-b25c-a860d3d72565")]
-  public abstract class UnsignedLongBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = UnsignedLongBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<UnsignedLongBox>(UnsignedLongBox.UnsignedLong, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(UnsignedLongBox.UnsignedLong).Value, type, mapper);
-    }
-    protected abstract ulong ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(ulong value, Type type, Mapper mapper);
-  }
-  [StorableType("1a6613b2-772f-4334-b688-8b2a8483123b")]
-  public abstract class FloatBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = FloatBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<FloatBox>(FloatBox.Float, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(FloatBox.Float).Value, type, mapper);
-    }
-    protected abstract float ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(float value, Type type, Mapper mapper);
-  }
-  [StorableType("c7fee156-6310-42a6-9f07-838cef8f405e")]
-  public abstract class DoubleBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = DoubleBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<DoubleBox>(DoubleBox.Double, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(DoubleBox.Double).Value, type, mapper);
-    }
-    protected abstract double ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(double value, Type type, Mapper mapper);
-  }
-  [StorableType("f7ea684c-8784-4939-80d4-318558a8b4a4")]
-  public abstract class StringBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = StringBox.CreateBuilder();
-      b.Value = ToBoxType(value, mapper);
-      box.SetExtension<StringBox>(StringBox.String, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(StringBox.String).Value, type, mapper);
-    }
-    protected abstract string ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(string value, Type type, Mapper mapper);
-  }
-  [StorableType("cb1680ec-3141-437d-b28d-f17595ca6815")]
-  public abstract class BytesBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = BytesBox.CreateBuilder();
-      b.Value = ByteString.CopyFrom(ToBoxType(value, mapper));
-      box.SetExtension<BytesBox>(BytesBox.Bytes, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(BytesBox.Bytes).Value.ToByteArray(), type, mapper);
-    }
-    protected abstract byte[] ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(byte[] value, Type type, Mapper mapper);
-  }
-  #endregion
-
-  #region Array Box Transformers
-  [StorableType("a6840c61-cf07-4e0a-a13c-392565e7326e")]
-  public abstract class ByteArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = ByteArrayBox.CreateBuilder();
-      b.SetValues(ToByteString(value));
-      box.SetExtension(ByteArrayBox.ByteArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return FromByteString(box.GetExtension(ByteArrayBox.ByteArray).Values);
-    }
-    protected abstract ByteString ToByteString(T value);
-    protected abstract T FromByteString(ByteString byteString);
-  }
-  [StorableType("543de8f9-bf32-431d-af52-8dd95cfd876f")]
-  public abstract class BoolArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = BoolArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<BoolArrayBox>(BoolArrayBox.BoolArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(BoolArrayBox.BoolArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<bool> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<bool> value, Type type, Mapper mapper);
-  }
-  [StorableType("fb338e93-09c1-4e6e-8731-c5fefbb7fa82")]
-  public abstract class IntArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = IntArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<IntArrayBox>(IntArrayBox.IntArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(IntArrayBox.IntArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<int> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<int> value, Type type, Mapper mapper);
-  }
-  [StorableType("f751fbbd-ddd9-4f22-bf5e-9336d8913ab0")]
-  public abstract class LongArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = LongArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<LongArrayBox>(LongArrayBox.LongArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(LongArrayBox.LongArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<long> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<long> value, Type type, Mapper mapper);
-  }
-  [StorableType("912793f8-0136-4621-880c-5d6da0bbefa5")]
-  public abstract class UnsignedIntArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = UnsignedIntArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<UnsignedIntArrayBox>(UnsignedIntArrayBox.UnsignedIntArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<uint> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<uint> value, Type type, Mapper mapper);
-  }
-  [StorableType("e9b844a1-9f14-438f-abd8-8af0fdb73d77")]
-  public abstract class UnsignedLongArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = UnsignedLongArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<UnsignedLongArrayBox>(UnsignedLongArrayBox.UnsignedLongArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(UnsignedLongArrayBox.UnsignedLongArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<ulong> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<ulong> value, Type type, Mapper mapper);
-  }
-  [StorableType("f08a787d-d695-44ee-a9ac-e8b966f98c34")]
-  public abstract class FloatArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = FloatArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<FloatArrayBox>(FloatArrayBox.FloatArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(FloatArrayBox.FloatArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<float> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<float> value, Type type, Mapper mapper);
-  }
-  [StorableType("622efa85-484e-459e-b79d-4462ba225394")]
-  public abstract class DoubleArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = DoubleArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<DoubleArrayBox>(DoubleArrayBox.DoubleArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(DoubleArrayBox.DoubleArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<double> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<double> value, Type type, Mapper mapper);
-  }
-  [StorableType("5dfba6f6-2762-4d08-9c34-f6d10cc20913")]
-  public abstract class StringArrayBoxTransformer<T> : BoxTransformer<T> {
-    protected override void Populate(Box.Builder box, T value, Mapper mapper) {
-      var b = StringArrayBox.CreateBuilder();
-      b.AddRangeValues(ToBoxType(value, mapper));
-      box.SetExtension<StringArrayBox>(StringArrayBox.StringArray, b.Build());
-    }
-    protected override T Extract(Box box, Type type, Mapper mapper) {
-      return ToValueType(box.GetExtension(StringArrayBox.StringArray).ValuesList, type, mapper);
-    }
-    protected abstract IEnumerable<string> ToBoxType(T value, Mapper mapper);
-    protected abstract T ToValueType(IEnumerable<string> value, Type type, Mapper mapper);
-  }
-  #endregion
-
-  [Transformer("11B822C9-46A0-4B65-AE4A-D12F63DDE9F6", 50)]
-  [StorableType("7d783c07-2e05-4d89-9c06-b243c546e667")]
+  [Transformer("854156DA-2A37-450F-92ED-355FBBD8D131", 50)]
+  [StorableType("D48991BB-1DDA-4D64-A2E6-5B5608F85F2A")]
   internal sealed class TypeTransformer : Transformer {
     public override bool CanTransformType(Type type) {
       return typeof(Type).IsAssignableFrom(type);
     }
+
     public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
+      var box = new Box {
+        TransformerId = mapper.GetTransformerId(this)
+      };
       Populate(box, o, mapper);
-      return box.Build();
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
+      return box;
+    }
+
+    private void Populate(Box box, object value, Mapper mapper) {
       var type = (Type)value;
-      var typeBox = TypeBox.CreateBuilder();
+      var typeBox = new TypeBox();
+
       if (type.IsGenericType) {
         box.TypeId = mapper.GetTypeId(type.GetGenericTypeDefinition());
-        typeBox.AddRangeGenericTypeIds(type.GetGenericArguments().Select(t => mapper.GetBoxId(t)));
+        typeBox.GenericTypeIds.AddRange(type.GetGenericArguments().Select(mapper.GetBoxId));
       } else if (type.IsArray) {
         box.TypeId = mapper.GetTypeId(typeof(Array));
-        typeBox.AddGenericTypeIds(mapper.GetBoxId(type.GetElementType()));
+        typeBox.GenericTypeIds.Add(mapper.GetBoxId(type.GetElementType()));
       } else {
         box.TypeId = mapper.GetTypeId(type);
@@ -320,17 +86,21 @@
       if (StorableTypeAttribute.IsStorableType(type))
         typeBox.Version = StorableTypeAttribute.GetStorableTypeAttribute(type).Version;
-      box.SetExtension(TypeBox.Type, typeBox.Build());
-    }
+
+      box.BoxId = mapper.GetTypeBoxId(typeBox);
+    }
+
     public override object ToObject(Box box, Mapper mapper) {
       return Extract(box, mapper.GetType(box.TypeId), mapper);
     }
+
     private object Extract(Box box, Type type, Mapper mapper) {
-      var b = box.GetExtension(TypeBox.Type);
+      var typeBox = mapper.GetTypeBox(box.BoxId);
+
       if (type.IsGenericType) {
-        return type.MakeGenericType(b.GenericTypeIdsList.Select(id => (Type)mapper.GetObject(id)).ToArray());
+        return type.MakeGenericType(typeBox.GenericTypeIds.Select(id => (Type)mapper.GetObject(id)).ToArray());
       } else if (type == typeof(Array)) {
-        return ((Type)mapper.GetObject(b.GetGenericTypeIds(0))).MakeArrayType();
+        return ((Type)mapper.GetObject(typeBox.GenericTypeIds[0])).MakeArrayType();
       } else {
-        
+
         return type;
       }
@@ -338,157 +108,547 @@
   }
 
-  #region Primitive Value Types
-  [Transformer("268617FE-3F0F-4029-8248-EDA420901FB6", 10000)]
-  [StorableType("320cba58-1aaf-492b-be3b-f59eea085ebe")]
-  internal sealed class ObjectTransformer : BoxTransformer<object> {
-    protected override void Populate(Box.Builder box, object value, Mapper mapper) { }
-    protected override object Extract(Box box, Type type, Mapper mapper) { return new object(); }
-  }
-
-  [Transformer("9FA1C6A8-517E-4623-AC1B-7E9AEF6ED13D", 200)]
-  [StorableType("be3c6d74-5c67-4a54-ab3c-f1040795d364")]
-  internal sealed class BoolTransformer : BoolBoxTransformer<bool> {
-    protected override bool ToBoxType(bool value, Mapper mapper) { return value; }
-    protected override bool ToValueType(bool value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("059633E9-12CB-43EC-8544-57746536E281", 201)]
-  [StorableType("3f1e111d-3ea8-4318-884f-185ef96bdfe4")]
-  internal sealed class ByteTransformer : UnsignedIntBoxTransformer<byte> {
-    protected override uint ToBoxType(byte value, Mapper mapper) { return value; }
-    protected override byte ToValueType(uint value, Type type, Mapper mapper) { return (byte)value; }
-  }
-
-  [Transformer("5DC2F3AC-0852-4B57-A861-D29CC814A94C", 202)]
-  [StorableType("498da443-43d3-4bc4-9ee9-c41416bb5c6b")]
-  internal sealed class SByteTransformer : IntBoxTransformer<sbyte> {
-    protected override int ToBoxType(sbyte value, Mapper mapper) { return value; }
-    protected override sbyte ToValueType(int value, Type type, Mapper mapper) { return (sbyte)value; }
-  }
-
-  [Transformer("B862E642-A94A-4870-8065-06126A35A9E1", 203)]
-  [StorableType("9f9ea850-1dd5-4dc0-abb5-8e75b22a0ffe")]
-  internal sealed class ShortTransformer : IntBoxTransformer<short> {
-    protected override int ToBoxType(short value, Mapper mapper) { return value; }
-    protected override short ToValueType(int value, Type type, Mapper mapper) { return (short)value; }
-  }
-
-  [Transformer("D1D3062D-F1BB-4189-AE50-D6986E1DEB4E", 204)]
-  [StorableType("4b70fdb5-a2ed-4a08-ab17-10fb5db11ada")]
-  internal sealed class UShortTransformer : UnsignedIntBoxTransformer<ushort> {
-    protected override uint ToBoxType(ushort value, Mapper mapper) { return value; }
-    protected override ushort ToValueType(uint value, Type type, Mapper mapper) { return (ushort)value; }
-  }
-
-  [Transformer("6C444645-3062-4D15-AD01-E6E1B0692A2B", 205)]
-  [StorableType("fdf24c34-7c10-49bb-aad2-a668c1490381")]
-  internal sealed class CharTransformer : UnsignedIntBoxTransformer<char> {
-    protected override uint ToBoxType(char value, Mapper mapper) { return value; }
-    protected override char ToValueType(uint value, Type type, Mapper mapper) { return (char)value; }
-  }
-
-  [Transformer("649E73B2-EFA6-4E01-BCB4-4B29D652C9CB", 206)]
-  [StorableType("0b2bcdf7-5787-4027-acd4-46f5f7641bff")]
-  internal sealed class IntTransformer : IntBoxTransformer<int> {
-    protected override int ToBoxType(int value, Mapper mapper) { return value; }
-    protected override int ToValueType(int value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("BCF25010-81A2-49BC-88CC-407D3F393D5B", 207)]
-  [StorableType("eec933ec-f705-435e-9b7e-e4fc4d90c21e")]
-  internal sealed class UIntTransformer : UnsignedIntBoxTransformer<uint> {
-    protected override uint ToBoxType(uint value, Mapper mapper) { return value; }
-    protected override uint ToValueType(uint value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("B6F6ACAE-755C-47EE-B8BF-7CDECBE19C30", 208)]
-  [StorableType("b0edffdd-8a00-48e1-a7a1-808ddec3b933")]
-  internal sealed class LongTransformer : LongBoxTransformer<long> {
-    protected override long ToBoxType(long value, Mapper mapper) { return value; }
-    protected override long ToValueType(long value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("82333ACA-F041-44E0-B365-27C399594BA7", 209)]
-  [StorableType("0ebd1d6b-aa2d-442b-b524-68558d77e22e")]
-  internal sealed class ULongTransformer : UnsignedLongBoxTransformer<ulong> {
-    protected override ulong ToBoxType(ulong value, Mapper mapper) { return value; }
-    protected override ulong ToValueType(ulong value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("8FE91ECF-2261-4934-BECD-C38923B7A703", 210)]
-  [StorableType("d9f05b32-218f-4b8e-9ec7-ab5dcbbaf0fc")]
-  internal sealed class FloatTransformer : FloatBoxTransformer<float> {
-    protected override float ToBoxType(float value, Mapper mapper) { return value; }
-    protected override float ToValueType(float value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("070D23EA-7F38-46B7-A667-219BEF914E49", 211)]
-  [StorableType("70b79b46-2713-42ac-ace6-a55ffb0624be")]
-  internal sealed class DoubleTransformer : DoubleBoxTransformer<double> {
-    protected override double ToBoxType(double value, Mapper mapper) { return value; }
-    protected override double ToValueType(double value, Type type, Mapper mapper) { return value; }
-  }
-
-  [Transformer("BA55C7A6-C91E-4351-A889-E4A7E647F16D", 212)]
-  [StorableType("4ed946fd-aac8-407b-bb9e-093048024d15")]
-  internal sealed class DateTimeTransformer : LongBoxTransformer<DateTime> {
-    protected override long ToBoxType(DateTime value, Mapper mapper) { return value.Ticks; }
-    protected override DateTime ToValueType(long value, Type type, Mapper mapper) { return new DateTime(value); }
-  }
-
-  [Transformer("0C91441B-2D97-432B-B493-D6EC483FC5AD", 213)]
-  [StorableType("bbc20151-b695-43dc-a38a-a610c8410fd2")]
-  internal sealed class TimeSpanTransformer : LongBoxTransformer<TimeSpan> {
-    protected override long ToBoxType(TimeSpan value, Mapper mapper) { return value.Ticks; }
-    protected override TimeSpan ToValueType(long value, Type type, Mapper mapper) { return new TimeSpan(value); }
-  }
-
-  [Transformer("2E6D4A40-B4BE-425F-8E35-2D7C00054639", 215)]
-  [StorableType("11a33d00-5edc-4c49-884a-9f2809c23b30")]
-  internal sealed class PointTransformer : IntArrayBoxTransformer<Point> {
-    protected override IEnumerable<int> ToBoxType(Point value, Mapper mapper) { return new int[] { value.X, value.Y }; }
-    protected override Point ToValueType(IEnumerable<int> value, Type type, Mapper mapper) { return new Point(value.ElementAt(0), value.ElementAt(1)); }
-  }
-
-  [Transformer("97B5CFC8-CDFA-4EB5-B4CD-5B3CFA5CD844", 216)]
-  [StorableType("993238c2-a2ed-4e0d-84ae-ad025f2f20f4")]
-  internal sealed class KeyValuePairTransformer : BoxTransformer<object> {
+  [Transformer("4C610596-5234-4C49-998E-30007D64492E", 100)]
+  [StorableType("69870239-00B7-4C9D-AF0B-14208069FAC8")]
+  internal sealed class StringBoxTransformer : BoxTransformer<string> {
+    protected override void Populate(Box box, string value, Mapper mapper) { box.UInt = mapper.GetStringId(value); }
+    protected override string Extract(Box box, Type type, Mapper mapper) { return mapper.GetString(box.UInt); }
+  }
+
+  [Transformer("58E69402-2533-426A-B9B5-9F2EB5241560", 101)]
+  [StorableType("667182BB-D2D5-46C6-97CB-593CE1B19CBC")]
+  internal sealed class BoolBoxTransformer : BoxTransformer<bool> {
+    protected override void Populate(Box box, bool value, Mapper mapper) { box.Bool = value; }
+    protected override bool Extract(Box box, Type type, Mapper mapper) { return box.Bool; }
+  }
+
+  [Transformer("D78F3391-3CAE-4376-9348-7FB38A4DE0EB", 102)]
+  [StorableType("1E75D1D8-3FAD-4D68-86BB-95DE981FDDD2")]
+  internal sealed class IntBoxTransformer : BoxTransformer<int> {
+    protected override void Populate(Box box, int value, Mapper mapper) { box.Int = value; }
+    protected override int Extract(Box box, Type type, Mapper mapper) { return box.Int; }
+  }
+
+  [Transformer("25881263-F452-492E-9FD1-24E1938B048B", 103)]
+  [StorableType("7742A4A3-31B4-4449-9657-0D9F50F2382F")]
+  internal sealed class UIntBoxTransformer : BoxTransformer<uint> {
+    protected override void Populate(Box box, uint value, Mapper mapper) { box.UInt = value; }
+    protected override uint Extract(Box box, Type type, Mapper mapper) { return box.UInt; }
+  }
+
+  [Transformer("F4175165-382B-4B03-921E-5F923510FB1E", 104)]
+  [StorableType("985427E0-E4F0-4182-8D30-63DA7FB69735")]
+  internal sealed class LongBoxTransformer : BoxTransformer<long> {
+    protected override void Populate(Box box, long value, Mapper mapper) { box.Long = value; }
+    protected override long Extract(Box box, Type type, Mapper mapper) { return box.Long; }
+  }
+
+  [Transformer("E8F63973-3C0C-4FA9-B068-40EF4463B30B", 105)]
+  [StorableType("C9F95D84-BCDC-498E-A9AE-7187E483BBBA")]
+  internal sealed class ULongBoxTransformer : BoxTransformer<ulong> {
+    protected override void Populate(Box box, ulong value, Mapper mapper) { box.ULong = value; }
+    protected override ulong Extract(Box box, Type type, Mapper mapper) { return box.ULong; }
+  }
+
+  [Transformer("15489146-EA11-4B90-8020-AF5C10A2531C", 106)]
+  [StorableType("AF1C5176-859C-423B-A2BF-2AEA4D0792C7")]
+  internal sealed class FloatBoxTransformer : BoxTransformer<float> {
+    protected override void Populate(Box box, float value, Mapper mapper) { box.Float = value; }
+    protected override float Extract(Box box, Type type, Mapper mapper) { return box.Float; }
+  }
+
+  [Transformer("91FD51F3-9C47-4944-AC85-273ED0561E87", 107)]
+  [StorableType("4AB25AE9-2600-4041-8F31-C02CCE9A3BEC")]
+  internal sealed class DoubleBoxTransformer : BoxTransformer<double> {
+    protected override void Populate(Box box, double value, Mapper mapper) { box.Double = value; }
+    protected override double Extract(Box box, Type type, Mapper mapper) { return box.Double; }
+  }
+
+  [Transformer("BCB087EA-E477-47EB-9BCE-8C64BAC2F288", 108)]
+  [StorableType("341C2F99-8849-408E-99AA-7700FE0FB789")]
+  internal sealed class ByteBoxTransformer : BoxTransformer<byte> {
+    protected override void Populate(Box box, byte value, Mapper mapper) { box.UInt = value; }
+    protected override byte Extract(Box box, Type type, Mapper mapper) { return (byte)box.UInt; }
+  }
+
+  [Transformer("B90F61D9-75D0-4CAC-AF93-B8C6AB68F642", 109)]
+  [StorableType("FEC52DD5-A422-45C4-995F-09F3B0DEC13F")]
+  internal sealed class SByteBoxTransformer : BoxTransformer<sbyte> {
+    protected override void Populate(Box box, sbyte value, Mapper mapper) { box.Int = value; }
+    protected override sbyte Extract(Box box, Type type, Mapper mapper) { return (sbyte)box.Int; }
+  }
+
+  [Transformer("95EB44A4-EADD-4DA9-B60F-3262FAD6134B", 110)]
+  [StorableType("48744968-15F2-4B22-AAF2-6C0910239384")]
+  internal sealed class ShortBoxTransformer : BoxTransformer<short> {
+    protected override void Populate(Box box, short value, Mapper mapper) { box.Int = value; }
+    protected override short Extract(Box box, Type type, Mapper mapper) { return (short)box.Int; }
+  }
+
+  [Transformer("E3A33614-9120-400E-BAD9-2594F6804DA8", 111)]
+  [StorableType("DCF05BA3-3C57-4DBB-96B4-B2CE31CA60C5")]
+  internal sealed class UShortBoxTransformer : BoxTransformer<ushort> {
+    protected override void Populate(Box box, ushort value, Mapper mapper) { box.Int = value; }
+    protected override ushort Extract(Box box, Type type, Mapper mapper) { return (ushort)box.Int; }
+  }
+
+  [Transformer("C64EA534-E2E1-48F0-86C5-648AA02117BC", 112)]
+  [StorableType("142980B3-A251-48D2-BF02-A66C483D6385")]
+  internal sealed class CharBoxTransformer : BoxTransformer<char> {
+    protected override void Populate(Box box, char value, Mapper mapper) { box.UInt = value; }
+    protected override char Extract(Box box, Type type, Mapper mapper) { return (char)box.UInt; }
+  }
+
+  [Transformer("D50C4782-7211-4476-B50F-7D3378EE3E53", 200)]
+  [StorableType("4397B775-7D48-4C2A-8D28-ACC8C196CF70")]
+  internal sealed class StringArrayBoxTransformer : BoxTransformer<string[]> {
+    protected override void Populate(Box box, string[] value, Mapper mapper) {
+      var unsignedIntArrayBox = new UnsignedIntArrayBox();
+      unsignedIntArrayBox.Values.AddRange(value.Select(mapper.GetStringId));
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(unsignedIntArrayBox);
+    }
+
+    protected override string[] Extract(Box box, Type type, Mapper mapper) {
+      var unsignedIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      return unsignedIntArrayBox.Values.Select(mapper.GetString).ToArray();
+    }
+  }
+
+  [Transformer("C9CFA67B-DF13-4125-B781-98EC8F5E390F", 201)]
+  [StorableType("9719DB59-C6BC-4788-BBB0-389A1B49CFEE")]
+  internal sealed class BoolArrayBoxTransformer : BoxTransformer<bool[]> {
+    protected override void Populate(Box box, bool[] value, Mapper mapper) {
+      var boolArrayBox = new BoolArrayBox();
+      boolArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetBoolArrayBoxId(boolArrayBox);
+    }
+
+    protected override bool[] Extract(Box box, Type type, Mapper mapper) {
+      var boolArrayBox = mapper.GetBoolArrayBox(box.BoxId);
+      return boolArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("BA2E18F6-5C17-40CA-A5B8-5690C5EFE872", 202)]
+  [StorableType("6548E9F0-621D-47BA-A605-8A47EF85C231")]
+  internal sealed class IntArrayBoxTransformer : BoxTransformer<int[]> {
+    protected override void Populate(Box box, int[] value, Mapper mapper) {
+      var intArrayBox = new IntArrayBox();
+      intArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetIntArrayBoxId(intArrayBox);
+    }
+
+    protected override int[] Extract(Box box, Type type, Mapper mapper) {
+      var intArrayBox = mapper.GetIntArrayBox(box.BoxId);
+      return intArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("EEE7710D-86DE-47E1-887D-BDA2996B141E", 203)]
+  [StorableType("4127B466-AFC0-4050-8C45-1376A0E3E016")]
+  internal sealed class UnsignedIntArrayBoxTransformer : BoxTransformer<uint[]> {
+    protected override void Populate(Box box, uint[] value, Mapper mapper) {
+      var unsignedIntArrayBox = new UnsignedIntArrayBox();
+      unsignedIntArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(unsignedIntArrayBox);
+    }
+
+    protected override uint[] Extract(Box box, Type type, Mapper mapper) {
+      var unsignedIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      return unsignedIntArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("557932AA-F023-477F-AAD0-5098E8B8CD56", 204)]
+  [StorableType("C2ED50C8-C340-40C1-B00C-2F398EB709A0")]
+  internal sealed class LongArrayBoxTransformer : BoxTransformer<long[]> {
+    protected override void Populate(Box box, long[] value, Mapper mapper) {
+      var longArrayBox = new LongArrayBox();
+      longArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetLongArrayBoxId(longArrayBox);
+    }
+
+    protected override long[] Extract(Box box, Type type, Mapper mapper) {
+      var longArrayBox = mapper.GetLongArrayBox(box.BoxId);
+      return longArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("CFF20DEE-2A55-4D04-B543-A4C7E0A8F7BF", 205)]
+  [StorableType("641AE353-5373-4811-BACB-C13D3144809C")]
+  internal sealed class UnsignedLongArrayBoxTransformer : BoxTransformer<ulong[]> {
+    protected override void Populate(Box box, ulong[] value, Mapper mapper) {
+      var unsignedLongArrayBox = new UnsignedLongArrayBox();
+      unsignedLongArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetUnsignedLongArrayBoxId(unsignedLongArrayBox);
+    }
+
+    protected override ulong[] Extract(Box box, Type type, Mapper mapper) {
+      var unsignedLongArrayBox = mapper.GetUnsignedLongArrayBox(box.BoxId);
+      return unsignedLongArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("2A0F766D-FE71-4415-A75F-A32FB8BB9E2D", 206)]
+  [StorableType("AEE9384F-3857-4CE4-AE30-B99474F7A6C9")]
+  internal sealed class FloatArrayBoxTransformer : BoxTransformer<float[]> {
+    protected override void Populate(Box box, float[] value, Mapper mapper) {
+      var floatArrayBox = new FloatArrayBox();
+      floatArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetFloatArrayBoxId(floatArrayBox);
+    }
+
+    protected override float[] Extract(Box box, Type type, Mapper mapper) {
+      var floatArrayBox = mapper.GetFloatArrayBox(box.BoxId);
+      return floatArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("192A8F7D-84C7-44BF-B0CA-AD387A241AAD", 207)]
+  [StorableType("17D0BA74-CB84-405C-8DBB-D9E361274A0A")]
+  internal sealed class DoubleArrayBoxTransformer : BoxTransformer<double[]> {
+    protected override void Populate(Box box, double[] value, Mapper mapper) {
+      var doubleArrayBox = new DoubleArrayBox();
+      doubleArrayBox.Values.AddRange(value);
+      box.BoxId = mapper.GetDoubleArrayBoxId(doubleArrayBox);
+    }
+
+    protected override double[] Extract(Box box, Type type, Mapper mapper) {
+      var doubleArrayBox = mapper.GetDoubleArrayBox(box.BoxId);
+      return doubleArrayBox.Values.ToArray();
+    }
+  }
+
+  [Transformer("3A35CECE-9953-4C29-A796-A56C02D80A05", 208)]
+  [StorableType("A076D11E-89AA-43C8-87F5-A0D0F52569EB")]
+  internal sealed class ByteArrayBoxTransformer : BoxTransformer<byte[]> {
+    protected override void Populate(Box box, byte[] value, Mapper mapper) {
+      box.Bytes = ByteString.CopyFrom(value);
+    }
+
+    protected override byte[] Extract(Box box, Type type, Mapper mapper) {
+      return box.Bytes.ToArray();
+    }
+  }
+
+  [Transformer("880D4A63-6C77-4F9F-8F7C-2D365F0AE829", 209)]
+  [StorableType("74F6FD4B-D7D7-43CD-B28B-3A775505FEE3")]
+  internal sealed class SByteArrayBoxTransformer : BoxTransformer<sbyte[]> {
+    protected override void Populate(Box box, sbyte[] value, Mapper mapper) {
+      box.Bytes = ByteString.CopyFrom(value.Select(x => (byte)x).ToArray());
+    }
+
+    protected override sbyte[] Extract(Box box, Type type, Mapper mapper) {
+      return box.Bytes.Select(x => (sbyte)x).ToArray();
+    }
+  }
+
+  [Transformer("9786E711-7C1D-4761-BD6B-445793834264", 210)]
+  [StorableType("5F32480E-AACB-4DB3-ADE3-1CF36E33C037")]
+  internal sealed class ShortArrayBoxTransformer : BoxTransformer<short[]> {
+    protected override void Populate(Box box, short[] value, Mapper mapper) {
+      var res = new byte[value.Length * 2];
+      for (int i = 0; i < value.Length; i++) {
+        var bytes = BitConverter.GetBytes(value[i]);
+        Array.Copy(bytes, 0, res, i * 2, 2);
+      }
+      box.Bytes = ByteString.CopyFrom(res);
+    }
+
+    protected override short[] Extract(Box box, Type type, Mapper mapper) {
+      var bytes = box.Bytes.ToArray();
+      var res = new short[bytes.Length / 2];
+      for (int i = 0; i < bytes.Length; i += 2) {
+        res[i / 2] = BitConverter.ToInt16(bytes, i);
+      }
+      return res;
+    }
+  }
+
+  [Transformer("1AAC2625-356C-40BC-8CB4-15CB3D047EB8", 211)]
+  [StorableType("C303B4CF-FFD0-47E2-9D94-07F2D558D17F")]
+  internal sealed class UShortArrayTransformer : BoxTransformer<ushort[]> {
+    protected override void Populate(Box box, ushort[] value, Mapper mapper) {
+      var res = new byte[value.Length * 2];
+      for (int i = 0; i < value.Length; i++) {
+        var bytes = BitConverter.GetBytes(value[i]);
+        Array.Copy(bytes, 0, res, i * 2, 2);
+      }
+      box.Bytes = ByteString.CopyFrom(res);
+    }
+
+    protected override ushort[] Extract(Box box, Type type, Mapper mapper) {
+      var bytes = box.Bytes.ToArray();
+      var res = new ushort[bytes.Length / 2];
+      for (int i = 0; i < bytes.Length; i += 2) {
+        res[i / 2] = BitConverter.ToUInt16(bytes, i);
+      }
+      return res;
+    }
+  }
+
+  [Transformer("12F19098-5D49-4C23-8897-69087F1C146D", 212)]
+  [StorableType("55F7C8B0-F2AA-4830-857D-6CE2807DA138")]
+  internal sealed class CharArrayTransformer : BoxTransformer<char[]> {
+    protected override void Populate(Box box, char[] value, Mapper mapper) {
+      var res = new byte[value.Length * 2];
+      for (int i = 0; i < value.Length; i++) {
+        var bytes = BitConverter.GetBytes(value[i]);
+        Array.Copy(bytes, 0, res, i * 2, 2);
+      }
+      box.Bytes = ByteString.CopyFrom(res);
+    }
+    protected override char[] Extract(Box box, Type type, Mapper mapper) {
+      var bytes = box.Bytes.ToArray();
+      var res = new char[bytes.Length / 2];
+      for (int i = 0; i < bytes.Length; i += 2) {
+        res[i / 2] = BitConverter.ToChar(bytes, i);
+      }
+      return res;
+    }
+  }
+
+  [Transformer("05AE4C5D-4D0C-47C7-B6D5-F04230C6F565", 301)]
+  [StorableType("A74820C8-F400-462A-913A-610BB588D04A")]
+  internal sealed class ArrayBoxTransformer : BoxTransformer<object> {
     public override bool CanTransformType(Type type) {
-      return type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(KeyValuePair<,>));
-    }
-    protected override void Populate(Box.Builder box, object value, Mapper mapper) {
-      var b = UnsignedIntArrayBox.CreateBuilder();
+      return type.IsArray;
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
       var type = value.GetType();
-      var pair = new uint[2];
-      pair[0] = mapper.GetBoxId(type.GetProperty("Key").GetValue(value));
-      pair[1] = mapper.GetBoxId(type.GetProperty("Value").GetValue(value));
-      b.AddRangeValues(pair);
-      box.SetExtension(UnsignedIntArrayBox.UnsignedIntArray, b.Build());
-    }
+      var array = (Array)value;
+      var rank = array.Rank;
+
+      var uIntArrayBox = new UnsignedIntArrayBox();
+      uIntArrayBox.Values.Add(mapper.GetBoxId(rank));
+
+      int[] lengths = new int[rank];
+      int[] lowerBounds = new int[rank];
+      for (int i = 0; i < rank; i++) {
+        lengths[i] = array.GetLength(i);
+        lowerBounds[i] = array.GetLowerBound(i);
+      }
+
+      uIntArrayBox.Values.AddRange(lengths.Select(x => mapper.GetBoxId(x)));
+      uIntArrayBox.Values.AddRange(lowerBounds.Select(x => mapper.GetBoxId(x)));
+
+      int[] positions = (int[])lowerBounds.Clone();
+      while (positions[rank - 1] < lengths[rank - 1] + lowerBounds[rank - 1]) {
+        uIntArrayBox.Values.Add(mapper.GetBoxId(array.GetValue(positions)));
+        positions[0] += 1;
+        for (int i = 0; i < rank - 1; i++) {
+          if (positions[i] >= lowerBounds[i] + lengths[i]) {
+            positions[i] = lowerBounds[i];
+            positions[i + 1] += 1;
+          } else {
+            break;
+          }
+        }
+      }
+
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(uIntArrayBox);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      var uIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var rank = (int)mapper.GetObject(uIntArrayBox.Values[0]);
+
+      int[] lengths = new int[rank], lowerBounds = new int[rank];
+      for (int i = 0; i < rank; i++)
+        lengths[i] = (int)mapper.GetObject(uIntArrayBox.Values[i + 1]);
+      for (int i = 0; i < rank; i++)
+        lowerBounds[i] = (int)mapper.GetObject(uIntArrayBox.Values[i + 1 + rank]);
+
+      return Array.CreateInstance(type.GetElementType(), lengths, lowerBounds);
+    }
+
     public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var b = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var key = mapper.GetObject(b.GetValues(0));
-      var val = mapper.GetObject(b.GetValues(1));
-      var type = obj.GetType();
-      //DataMemberAccessor.GenerateFieldSetter(type.GetField("key", BindingFlags.NonPublic | BindingFlags.Instance))(obj, key);
-      //DataMemberAccessor.GenerateFieldSetter(type.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance))(obj, val);
-      type.GetField("key", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(obj, key);
-      type.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(obj, val);
-    }
+      var array = (Array)obj;
+      var uIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var rank = (int)mapper.GetObject(uIntArrayBox.Values[0]);
+
+      int[] lengths = new int[rank], lowerBounds = new int[rank];
+      for (int i = 0; i < rank; i++)
+        lengths[i] = (int)mapper.GetObject(uIntArrayBox.Values[i + 1]);
+      for (int i = 0; i < rank; i++)
+        lowerBounds[i] = (int)mapper.GetObject(uIntArrayBox.Values[i + 1 + rank]);
+
+      int[] positions = (int[])lowerBounds.Clone();
+      var e = uIntArrayBox.Values.Skip(1 + 2 * rank).GetEnumerator();
+      while (e.MoveNext()) {
+        int[] currentPositions = positions;
+        array.SetValue(mapper.GetObject(e.Current), currentPositions);
+        positions[0] += 1;
+        for (int i = 0; i < rank - 1; i++) {
+          if (positions[i] >= lengths[i] + lowerBounds[i]) {
+            positions[i] = lowerBounds[i];
+            positions[i + 1] += 1;
+          } else {
+            break;
+          }
+        }
+      }
+    }
+  }
+
+  [Transformer("26AD5F85-1D77-4579-BCB9-CD409B48AC7A", 302)]
+  [StorableType("A96E2C1E-EBDF-4D81-A0ED-91677BC84FEE")]
+  internal sealed class EnumerableBoxTransformer : BoxTransformer<object> {
+    private static readonly HashSet<Type> supportedTypes = new HashSet<Type> {
+      typeof(Stack<>), typeof(Stack),
+      typeof(Queue<>), typeof(Queue),
+      typeof(HashSet<>),
+      typeof(List<>), typeof(ArrayList)
+    };
+
+    public override bool CanTransformType(Type type) {
+      return type.IsGenericType && supportedTypes.Contains(type.GetGenericTypeDefinition()) || supportedTypes.Contains(type);
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var uIntArrayBox = new UnsignedIntArrayBox();
+
+      var type = value.GetType();
+      var propertyInfo = type.GetProperty("Comparer");
+      if (propertyInfo != null) {
+        // TODO: where to store id for comparer box? (atm: first element in int array ...)
+        var comparer = propertyInfo.GetValue(value);
+        var comparerType = comparer.GetType();
+        if (StorableTypeAttribute.IsStorableType(comparerType))
+          uIntArrayBox.Values.Add(mapper.GetBoxId(comparer));
+        else if (comparerType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Any())
+          throw new NotSupportedException("Cannot serialize non-storable equality comparers with fields");
+        else
+          uIntArrayBox.Values.Add(mapper.GetBoxId(comparerType));
+      }
+
+      foreach (var item in (IEnumerable)value)
+        uIntArrayBox.Values.Add(mapper.GetBoxId(item));
+
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(uIntArrayBox);
+    }
+
     protected override object Extract(Box box, Type type, Mapper mapper) {
       return Activator.CreateInstance(type);
     }
-  }
-
-  [Transformer("EBD8BF65-D97D-4FD4-BF4F-9D58A72B6249", 217)]
-  [StorableType("b7725dfa-94fb-4169-b375-6e46b7ca4810")]
-  internal sealed class DecimalTransformer : UnsignedIntBoxTransformer<decimal> {
-    protected override uint ToBoxType(decimal value, Mapper mapper) {
-      return mapper.GetStringId(FormatG30(value));
-    }
-    protected override decimal ToValueType(uint value, Type type, Mapper mapper) {
-      var converter = TypeDescriptor.GetConverter(typeof(Font));
-      return ParseG30(mapper.GetString(value));
-    }
+
+    public override void FillFromBox(object obj, Box box, Mapper mapper) {
+      var uIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var elements = uIntArrayBox.Values.Select(mapper.GetObject);
+      var type = obj.GetType();
+
+      string methodName = string.Empty;
+      if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Stack<>) || type == typeof(Stack)) {
+        elements = elements.Reverse();
+        methodName = "Push";
+      } else if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Queue<>) || type == typeof(Queue)) {
+        methodName = "Enqueue";
+      } else {
+        methodName = "Add";
+        if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(HashSet<>)) {
+          var fieldInfo = type.GetField("m_comparer", BindingFlags.NonPublic | BindingFlags.Instance);
+          var comparerObj = mapper.GetObject(uIntArrayBox.Values[0]);
+          var comparer = comparerObj is Type ? Activator.CreateInstance((Type)comparerObj) : comparerObj;
+          fieldInfo.SetValue(obj, comparer);
+          elements = elements.Skip(1);
+        }
+      }
+
+      MethodInfo addMethod = type.GetMethod(methodName);
+      foreach (var e in elements)
+        addMethod.Invoke(obj, new[] { e });
+    }
+  }
+
+  [Transformer("C47A62F5-F113-4A43-A8EE-CF817EC799A2", 303)]
+  [StorableType("BA53DF84-DC97-4D8D-A493-868972ED1002")]
+  internal sealed class DictionaryTransformer : BoxTransformer<object> {
+    public override bool CanTransformType(Type type) {
+      return type.IsGenericType && typeof(Dictionary<,>) == type.GetGenericTypeDefinition();
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var dictionaryBox = new DictionaryBox();
+      foreach (DictionaryEntry item in (IDictionary)value) {
+        dictionaryBox.KeyValuePairs.Add(mapper.GetBoxId(item.Key), mapper.GetBoxId(item.Value));
+      }
+
+      var type = value.GetType();
+      var propertyInfo = type.GetProperty("Comparer");
+      var comparer = propertyInfo.GetValue(value);
+
+      var comparerType = comparer.GetType();
+      if (StorableTypeAttribute.IsStorableType(comparerType))
+        dictionaryBox.ComparerId = mapper.GetBoxId(comparer);
+      else if (comparerType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Any())
+        throw new NotSupportedException("Cannot serialize non-storable equality comparers with fields");
+      else
+        dictionaryBox.ComparerId = mapper.GetBoxId(comparerType);
+
+      box.BoxId = mapper.GetDictionaryBoxId(dictionaryBox);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      var dictionaryBox = mapper.GetDictionaryBox(box.BoxId);
+      return Activator.CreateInstance(type, dictionaryBox.KeyValuePairs.Count);
+    }
+
+    public override void FillFromBox(object obj, Box box, Mapper mapper) {
+      var type = obj.GetType();
+      var dictionaryBox = mapper.GetDictionaryBox(box.BoxId);
+      var comparerObj = mapper.GetObject(dictionaryBox.ComparerId);
+      var comparer = comparerObj is Type ? Activator.CreateInstance((Type)comparerObj) : comparerObj;
+
+      var fieldInfo = type.GetField("comparer", BindingFlags.NonPublic | BindingFlags.Instance);
+      fieldInfo.SetValue(obj, comparer);
+
+      var addMethod = type.GetMethod("Add");
+      foreach (var entry in dictionaryBox.KeyValuePairs) {
+        var key = mapper.GetObject(entry.Key);
+        var value = mapper.GetObject(entry.Value);
+        addMethod.Invoke(obj, new[] { key, value });
+      }
+    }
+
+    [Transformer("93FF076B-BC4B-4C39-8C40-15E004468C98", 219)]
+    [StorableType("F8A7DBB4-E1CE-4DB8-905E-F3A05F5CA000")]
+    internal sealed class EnumTransformer : Transformer {
+      public override bool CanTransformType(Type type) {
+        return typeof(Enum).IsAssignableFrom(type);
+      }
+
+      public override Box ToBox(object o, Mapper mapper) {
+        var box = new Box {
+          TransformerId = mapper.GetTransformerId(this),
+          TypeId = mapper.GetStringId(o.GetType().AssemblyQualifiedName),
+          UInt = mapper.GetStringId(Enum.Format(o.GetType(), o, "G")),
+        };
+        return box;
+      }
+
+      public override object ToObject(Box box, Mapper mapper) {
+        return Enum.Parse(Type.GetType(mapper.GetString(box.TypeId)), mapper.GetString(box.UInt));
+      }
+    }
+
+    [Transformer("268617FE-3F0F-4029-8248-EDA420901FB6", 10000)]
+    [StorableType("320CBA58-1AAF-492B-BE3B-F59EEA085EBE")]
+    internal sealed class ObjectBoxTransformer : BoxTransformer<object> {
+      protected override void Populate(Box box, object value, Mapper mapper) { }
+      protected override object Extract(Box box, Type type, Mapper mapper) { return new object(); }
+    }
+  }
+
+  [Transformer("90F9F16D-9F94-491B-AC3B-E1C6F3432127", 400)]
+  [StorableType("C3C23FEE-DB96-4CEA-A38B-6BB73811F877")]
+  internal sealed class DecimalBoxTransformer : BoxTransformer<decimal> {
+    protected override decimal Extract(Box box, Type type, Mapper mapper) {
+      return ParseG30(mapper.GetString(box.UInt));
+    }
+
+    protected override void Populate(Box box, decimal value, Mapper mapper) {
+      box.UInt = mapper.GetStringId(FormatG30(value));
+    }
+
     private static decimal ParseG30(string s) {
       decimal d;
@@ -501,64 +661,197 @@
         string.Format("Invalid decimal G30 number format \"{0}\" could not be parsed", s));
     }
+
     private static string FormatG30(decimal d) {
       return d.ToString("g30", CultureInfo.InvariantCulture);
     }
   }
-  #endregion
-
-  #region String
-  [Transformer("E75A594C-0034-4DAB-B28E-8F84F9F6DE8D", 218)]
-  [StorableType("ba52fce8-bf0c-47ad-95dd-df5d9281942d")]
-  internal sealed class StringTransformer : UnsignedIntBoxTransformer<string> {
-    protected override uint ToBoxType(string value, Mapper mapper) { return mapper.GetStringId(value); }
-    protected override string ToValueType(uint value, Type type, Mapper mapper) { return mapper.GetString(value); }
-  }
-  #endregion
-
-  #region Enum
-  [Transformer("93FF076B-BC4B-4C39-8C40-15E004468C98", 219)]
-  [StorableType("f8a7dbb4-e1ce-4db8-905e-f3a05f5ca000")]
-  internal sealed class EnumTransformer : Transformer {
+
+  [Transformer("1C6C350F-B2C8-40F0-A964-54DDB0D087A3", 401)]
+  [StorableType("9D99D155-E3BB-40CE-AF64-6E153D876148")]
+  internal sealed class DateTimeBoxTransformer : BoxTransformer<DateTime> {
+    protected override void Populate(Box box, DateTime value, Mapper mapper) {
+      box.Long = value.Ticks;
+    }
+
+    protected override DateTime Extract(Box box, Type type, Mapper mapper) {
+      return new DateTime(box.Long);
+    }
+  }
+
+  [Transformer("964074C9-4B82-4725-97AF-612A193EA5C6", 402)]
+  [StorableType("9CA7C1F7-784C-48D5-A6F4-E1FD7B3A2FEC")]
+  internal sealed class TimeSpanBoxTransformer : BoxTransformer<TimeSpan> {
+    protected override void Populate(Box box, TimeSpan value, Mapper mapper) {
+      box.Long = value.Ticks;
+    }
+
+    protected override TimeSpan Extract(Box box, Type type, Mapper mapper) {
+      return new TimeSpan(box.Long);
+    }
+  }
+
+  [Transformer("B0C0165B-6279-4CC3-8DB7-D36898BFBC38", 403)]
+  [StorableType("ED6B7AE1-CE2B-4891-9BF3-72F5D1D67D93")]
+  internal sealed class PointTransformer : BoxTransformer<Point> {
+    protected override void Populate(Box box, Point value, Mapper mapper) {
+      var intArrayBox = new IntArrayBox();
+      intArrayBox.Values.AddRange(new[] { value.X, value.Y });
+      box.BoxId = mapper.GetIntArrayBoxId(intArrayBox);
+    }
+
+    protected override Point Extract(Box box, Type type, Mapper mapper) {
+      var intArrayBox = mapper.GetIntArrayBox(box.BoxId);
+      return new Point(intArrayBox.Values[0], intArrayBox.Values[1]);
+    }
+  }
+
+  [Transformer("D0ADB806-2DFD-459D-B5DA-14B5F1152534", 404)]
+  [StorableType("B13D6153-E71D-4B76-9893-81D3570403E8")]
+  internal sealed class BitmapTransformer : BoxTransformer<Bitmap> {
+    protected override void Populate(Box box, Bitmap value, Mapper mapper) {
+      lock (value)
+        using (var ms = new MemoryStream()) {
+          value.Save(ms, ImageFormat.Png);
+          box.Bytes = ByteString.CopyFrom(ms.ToArray());
+        }
+    }
+
+    protected override Bitmap Extract(Box box, Type type, Mapper mapper) {
+      using (var ms = new MemoryStream()) {
+        ms.Write(box.Bytes.ToArray(), 0, box.Bytes.Length);
+        ms.Seek(0, SeekOrigin.Begin);
+        return new Bitmap(ms);
+      }
+    }
+  }
+
+  [Transformer("AFF27987-3301-4D70-9601-EFCA31BDA0DB", 405)]
+  [StorableType("B9F9A371-4DCB-478B-B0D4-6F87A15C02B5")]
+  internal sealed class FontTransformer : BoxTransformer<Font> {
+    protected override void Populate(Box box, Font value, Mapper mapper) {
+      var unsignedIntArrayBox = new UnsignedIntArrayBox();
+      unsignedIntArrayBox.Values.Add(mapper.GetStringId(GetFontFamilyName(value.FontFamily)));
+      unsignedIntArrayBox.Values.Add(mapper.GetBoxId(value.Size));
+      unsignedIntArrayBox.Values.Add(mapper.GetBoxId(value.Style));
+      unsignedIntArrayBox.Values.Add(mapper.GetBoxId(value.Unit));
+      unsignedIntArrayBox.Values.Add(mapper.GetBoxId(value.GdiCharSet));
+      unsignedIntArrayBox.Values.Add(mapper.GetBoxId(value.GdiVerticalFont));
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(unsignedIntArrayBox);
+    }
+
+    protected override Font Extract(Box box, Type type, Mapper mapper) {
+      var value = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var fontData = value.Values;
+      return new Font(
+        GetFontFamily(mapper.GetString(fontData[0])),
+        (float)mapper.GetObject(fontData[1]),
+        (FontStyle)mapper.GetObject(fontData[2]),
+        (GraphicsUnit)mapper.GetObject(fontData[3]),
+        (byte)mapper.GetObject(fontData[4]),
+        (bool)mapper.GetObject(fontData[5])
+      );
+    }
+
+    public const string GENERIC_MONOSPACE_NAME = "_GenericMonospace";
+    public const string GENERIC_SANS_SERIF_NAME = "_GenericSansSerif";
+    public const string GENERIC_SERIF_NAME = "_GenericSerif";
+
+    public static FontFamily GetFontFamily(string name) {
+      if (name == GENERIC_MONOSPACE_NAME) return FontFamily.GenericMonospace;
+      if (name == GENERIC_SANS_SERIF_NAME) return FontFamily.GenericSansSerif;
+      if (name == GENERIC_SERIF_NAME) return FontFamily.GenericSerif;
+      return new FontFamily(name);
+    }
+
+    public static string GetFontFamilyName(FontFamily ff) {
+      if (ff.Equals(FontFamily.GenericMonospace)) return GENERIC_MONOSPACE_NAME;
+      if (ff.Equals(FontFamily.GenericSansSerif)) return GENERIC_SANS_SERIF_NAME;
+      if (ff.Equals(FontFamily.GenericSerif)) return GENERIC_SERIF_NAME;
+      return ff.Name;
+    }
+  }
+
+  [Transformer("D912D573-CE41-40B8-8F95-646C183662F6", 406)]
+  [StorableType("3ED2C12F-BE41-45F5-AA0A-C2F23EB99FBD")]
+  internal sealed class KeyValuePairBoxTransformer : BoxTransformer<object> {
     public override bool CanTransformType(Type type) {
-      return typeof(Enum).IsAssignableFrom(type);
-    }
-
-    public override Box ToBox(object o, Mapper mapper) {
-      var boxBuilder = Box.CreateBuilder();
-      var enumBuilder = new UnsignedIntBox.Builder();
-
-      boxBuilder.TransformerId = mapper.GetTransformerId(this);
-      boxBuilder.TypeId = mapper.GetStringId(o.GetType().AssemblyQualifiedName);
-      enumBuilder.Value = mapper.GetStringId(Enum.Format(o.GetType(), o, "G"));
-
-      boxBuilder.SetExtension(UnsignedIntBox.UnsignedInt, enumBuilder.Build());
-      return boxBuilder.Build();
-    }
-
-    public override object ToObject(Box box, Mapper mapper) {
-      uint value = box.GetExtension(UnsignedIntBox.UnsignedInt).Value;
-      return Enum.Parse(Type.GetType(mapper.GetString(box.TypeId)), mapper.GetString(value));
-    }
-  }
-  #endregion
-
-  #region Struct
-  [Transformer("89DAAFC5-726C-48D4-A4E0-2B0D27329642", 220)]
-  [StorableType("c3c4ad38-7110-439c-b73c-d33466db3db4")]
-  internal sealed class StructTransformer : Transformer {
+      return type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(KeyValuePair<,>));
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var unsignedIntArrayBox = new UnsignedIntArrayBox();
+      var type = value.GetType();
+      var pair = new uint[2];
+      pair[0] = mapper.GetBoxId(type.GetProperty("Key").GetValue(value));
+      pair[1] = mapper.GetBoxId(type.GetProperty("Value").GetValue(value));
+      unsignedIntArrayBox.Values.AddRange(pair);
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(unsignedIntArrayBox);
+    }
+
+    public override void FillFromBox(object obj, Box box, Mapper mapper) {
+      var b = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var key = mapper.GetObject(b.Values[0]);
+      var val = mapper.GetObject(b.Values[1]);
+      var type = obj.GetType();
+      //DataMemberAccessor.GenerateFieldSetter(type.GetField("key", BindingFlags.NonPublic | BindingFlags.Instance))(obj, key);
+      //DataMemberAccessor.GenerateFieldSetter(type.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance))(obj, val);
+      type.GetField("key", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(obj, key);
+      type.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(obj, val);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      return Activator.CreateInstance(type);
+    }
+  }
+
+  [Transformer("BBA08D33-FDA4-4EB6-8D94-9BF3D30C3E11", 407)]
+  [StorableType("B0333A12-7D91-47A5-ACD4-49E43E5A18DC")]
+  internal sealed class TupleBoxTransformer : BoxTransformer<object> {
+    private static readonly HashSet<Type> supportedTypes = new HashSet<Type> {
+      typeof(Tuple<>), typeof(Tuple<,>), typeof(Tuple<,,>), typeof(Tuple<,,,>),
+      typeof(Tuple<,,,,>), typeof(Tuple<,,,,,>), typeof(Tuple<,,,,,,>), typeof(Tuple<,,,,,,,>)
+    };
+
+    public override bool CanTransformType(Type type) {
+      return type.IsGenericType && supportedTypes.Contains(type.GetGenericTypeDefinition());
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var type = value.GetType();
+      var uIntArrayBox = new UnsignedIntArrayBox();
+      for (int i = 1; i <= type.GetGenericArguments().Length; i++) {
+        string name = string.Format("Item{0}", i);
+        uIntArrayBox.Values.Add(mapper.GetBoxId(type.GetProperty(name).GetValue(value)));
+      }
+      box.BoxId = mapper.GetUnsignedIntArrayBoxId(uIntArrayBox);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      var defaultValues = type.GetGenericArguments().Select(x =>
+        x.IsValueType ? Activator.CreateInstance(x) : null
+      ).ToArray();
+      return Activator.CreateInstance(type, defaultValues);
+    }
+
+    public override void FillFromBox(object obj, Box box, Mapper mapper) {
+      var uIntArrayBox = mapper.GetUnsignedIntArrayBox(box.BoxId);
+      var elements = uIntArrayBox.Values.Select(mapper.GetObject).ToArray();
+      var type = obj.GetType();
+      for (int i = 1; i <= elements.Length; i++) {
+        string name = string.Format("m_Item{0}", i);
+        DataMemberAccessor.GenerateFieldSetter(type.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance))(obj, elements[i - 1]);
+      }
+    }
+  }
+
+  [Transformer("731F9A18-6BF4-43BE-95CF-8205552C9B70", 500)]
+  [StorableType("73FCDE79-436D-476E-B2EA-A7A1A4A810B5")]
+  internal sealed class StructBoxTransformer : BoxTransformer<object> {
     public override bool CanTransformType(Type type) {
       return type.IsValueType && !type.IsPrimitive && !type.IsEnum && type.IsSealed;
     }
-    public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      Populate(box, o, mapper);
-      return box.Build();
-    }
-    public override object ToObject(Box box, Mapper mapper) {
-      return Extract(box, (Type)mapper.GetObject(box.TypeId), mapper);
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
-      var b = StorableClassBox.CreateBuilder();
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var b = new StorableClassBox();
       var type = value.GetType();
 
@@ -569,17 +862,18 @@
       }
 
-      b.AddRangeKeyIds(components.Keys);
-      b.AddRangeValueIds(components.Values);
-
-      box.TypeId = mapper.GetBoxId(type);
-      box.SetExtension(StorableClassBox.StorableClass, b.Build());
-    }
-    private object Extract(Box box, Type type, Mapper mapper) {
-      var data = box.GetExtension(StorableClassBox.StorableClass);
+      foreach (var component in components) {
+        b.KeyValuePairs.Add(component.Key, component.Value);
+      }
+
+      box.BoxId = mapper.GetStorableClassBoxId(b);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      var data = mapper.GetStorableClassBox(box.BoxId);
       var obj = Activator.CreateInstance(type);
 
       var components = new Dictionary<uint, uint>();
-      for (int i = 0; i < data.KeyIdsList.Count; i++) {
-        components.Add(data.KeyIdsList[i], data.ValueIdsList[i]);
+      foreach (var kvp in data.KeyValuePairs) {
+        components.Add(kvp.Key, kvp.Value);
       }
 
@@ -600,478 +894,131 @@
       return obj;
     }
-  }
-  #endregion
-
-  #region Tuple
-  [Transformer("63A19D57-EEEF-4346-9F06-B35B15EBFFA3", 221)]
-  [StorableType("ab537f25-dc21-4585-b743-0350a5cf1e54")]
-  internal sealed class TupleTransformer : Transformer {
-    private static readonly HashSet<Type> supportedTypes = new HashSet<Type> {
-      typeof(Tuple<>), typeof(Tuple<,>), typeof(Tuple<,,>), typeof(Tuple<,,,>),
-      typeof(Tuple<,,,,>), typeof(Tuple<,,,,,>), typeof(Tuple<,,,,,,>), typeof(Tuple<,,,,,,,>)
-    };
+
+  }
+
+  [Transformer("78556C88-0FEE-4602-95C7-A469B2DDB468", 600)]
+  [StorableType("3A578289-43CA-40F8-9F1E-2BDD255CB8FB")]
+  internal sealed class StorableTypeBoxTransformer : BoxTransformer<object> {
     public override bool CanTransformType(Type type) {
-      return type.IsGenericType && supportedTypes.Contains(type.GetGenericTypeDefinition());
-    }
-    public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      Populate(box, o, mapper);
-      return box.Build();
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
+      return StorableTypeAttribute.IsStorableType(type) && !type.IsValueType && !type.IsEnum || // don't transform structs or enums
+        type.BaseType != null && CanTransformType(type.BaseType);
+    }
+
+    protected override void Populate(Box box, object value, Mapper mapper) {
+      var b = new StorableClassBox();
       var type = value.GetType();
-      var uIntArrayBox = UnsignedIntArrayBox.CreateBuilder();
-      for (int i = 1; i <= type.GetGenericArguments().Length; i++) {
-        string name = string.Format("Item{0}", i);
-        uIntArrayBox.AddValues(mapper.GetBoxId(type.GetProperty(name).GetValue(value)));
-      }
-      box.TypeId = mapper.GetBoxId(type);
-      box.SetExtension(UnsignedIntArrayBox.UnsignedIntArray, uIntArrayBox.Build());
-    }
-    public override object ToObject(Box box, Mapper mapper) {
-      var type = (Type)mapper.GetObject(box.TypeId);
-      var defaultValues = type.GetGenericArguments().Select(x =>
-        x.IsValueType ? Activator.CreateInstance(x) : null
-      ).ToArray();
-      return Activator.CreateInstance(type, defaultValues);
-    }
+      var typeInfo = Mapper.StaticCache.GetTypeInfo(type);
+
+      var emptyArgs = new object[0];
+      foreach (var hook in typeInfo.BeforeSerializationHooks) {
+        hook.Invoke(value, emptyArgs);
+      }
+
+      var components = new Dictionary<uint, uint>();
+      foreach (var componentInfo in typeInfo.Fields) {
+        var field = (FieldInfo)componentInfo.MemberInfo;
+        var component = mapper.GetBoxId(field.GetValue(value));
+        components.Add(mapper.GetStringId(componentInfo.Name), component);
+      }
+
+      foreach (var componentInfo in typeInfo.Properties.Where(x => x.Readable)) {
+        var property = (PropertyInfo)componentInfo.MemberInfo;
+        var component = mapper.GetBoxId(property.GetValue(value, null));
+        components.Add(mapper.GetStringId(componentInfo.Name), component);
+      }
+
+      foreach (var component in components) {
+        b.KeyValuePairs.Add(component.Key, component.Value);
+      }
+
+      box.BoxId = mapper.GetStorableClassBoxId(b);
+    }
+
+    protected override object Extract(Box box, Type type, Mapper mapper) {
+      return mapper.CreateInstance(type);
+    }
+
     public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var uIntArrayBox = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var elements = uIntArrayBox.ValuesList.Select(mapper.GetObject).ToArray();
+      var data = mapper.GetStorableClassBox(box.BoxId);
       var type = obj.GetType();
-      for (int i = 1; i <= elements.Length; i++) {
-        string name = string.Format("m_Item{0}", i);
-        DataMemberAccessor.GenerateFieldSetter(type.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance))(obj, elements[i - 1]);
-      }
-    }
-  }
-  #endregion
-
-  #region Bitmap
-  [Transformer("D0ADB806-2DFD-459D-B5DA-14B5F1152534", 222)]
-  [StorableType("b13d6153-e71d-4b76-9893-81d3570403e8")]
-  internal sealed class BitmapTransformer : ByteArrayBoxTransformer<Bitmap> {
-    protected override ByteString ToByteString(Bitmap value) {
-      lock (value)
-        using (var ms = new MemoryStream()) {
-          value.Save(ms, ImageFormat.Png);
-          return ByteString.CopyFrom(ms.ToArray());
+      var typeInfo = Mapper.StaticCache.GetTypeInfo(type);
+      var typeBox = mapper.GetTypeBox(mapper.GetBox(box.TypeId).BoxId);
+      var version = Math.Max(typeBox.Version, 1);
+      var typeGuid = typeInfo.StorableTypeAttribute.Guid;
+
+      var components = new Dictionary<uint, uint>();
+      foreach (var kvp in data.KeyValuePairs) {
+        components.Add(kvp.Key, kvp.Value);
+      }
+
+      var conversionMethods =
+        type.Assembly.GetTypes().SelectMany(t =>
+          t.GetMethods(BindingFlags.NonPublic | BindingFlags.Static)
+          .Where(StorableConversionAttribute.IsStorableConversionMethod)
+          .Where(mi => StorableConversionAttribute.GetGuid(mi) == typeGuid &&
+                       StorableConversionAttribute.GetVersion(mi) >= version))
+          .OrderBy(StorableConversionAttribute.GetVersion)
+          .ToArray();
+
+      // put all objects into dictionary for conversion 
+      var dict = new Dictionary<string, object>();
+      foreach (var component in components) {
+        dict.Add(mapper.GetString(component.Key), mapper.GetObject(component.Value));
+      }
+
+      Dictionary<string, object> lastDict = new Dictionary<string, object>();
+      foreach (var convMeth in conversionMethods) {
+        if (StorableConversionAttribute.GetVersion(convMeth) != version)
+          throw new PersistenceException(string.Format("No conversion method defined for type {0} version {1}", typeGuid, version));
+        lastDict = (Dictionary<string, object>)convMeth.Invoke(null, new object[] { dict });
+        foreach (var kvp in lastDict) {
+          dict[kvp.Key] = kvp.Value;
         }
-    }
-    protected override Bitmap FromByteString(ByteString byteString) {
-      using (var ms = new MemoryStream()) {
-        ms.Write(byteString.ToArray(), 0, byteString.Length);
-        ms.Seek(0, SeekOrigin.Begin);
-        return new Bitmap(ms);
-      }
-    }
-  }
-  #endregion
-
-  #region Font
-  [Transformer("AFF27987-3301-4D70-9601-EFCA31BDA0DB", 223)]
-  [StorableType("b9f9a371-4dcb-478b-b0d4-6f87a15c02b5")]
-  internal sealed class FontTransformer : UnsignedIntArrayBoxTransformer<Font> {
-
-    protected override IEnumerable<uint> ToBoxType(Font value, Mapper mapper) {
-      yield return mapper.GetStringId(GetFontFamilyName(value.FontFamily));
-      yield return mapper.GetBoxId(value.Size);
-      yield return mapper.GetBoxId(value.Style);
-      yield return mapper.GetBoxId(value.Unit);
-      yield return mapper.GetBoxId(value.GdiCharSet);
-      yield return mapper.GetBoxId(value.GdiVerticalFont);
-    }
-    protected override Font ToValueType(IEnumerable<uint> value, Type type, Mapper mapper) {
-      var fontData = value.ToArray();
-      return new Font(
-        GetFontFamily(mapper.GetString(fontData[0])),
-        (float)mapper.GetObject(fontData[1]),
-        (FontStyle)mapper.GetObject(fontData[2]),
-        (GraphicsUnit)mapper.GetObject(fontData[3]),
-        (byte)mapper.GetObject(fontData[4]),
-        (bool)mapper.GetObject(fontData[5])
-      );
-    }
-
-    public const string GENERIC_MONOSPACE_NAME = "_GenericMonospace";
-    public const string GENERIC_SANS_SERIF_NAME = "_GenericSansSerif";
-    public const string GENERIC_SERIF_NAME = "_GenericSerif";
-
-    public static FontFamily GetFontFamily(string name) {
-      if (name == GENERIC_MONOSPACE_NAME) return FontFamily.GenericMonospace;
-      if (name == GENERIC_SANS_SERIF_NAME) return FontFamily.GenericSansSerif;
-      if (name == GENERIC_SERIF_NAME) return FontFamily.GenericSerif;
-      return new FontFamily(name);
-    }
-
-    public static string GetFontFamilyName(FontFamily ff) {
-      if (ff.Equals(FontFamily.GenericMonospace)) return GENERIC_MONOSPACE_NAME;
-      if (ff.Equals(FontFamily.GenericSansSerif)) return GENERIC_SANS_SERIF_NAME;
-      if (ff.Equals(FontFamily.GenericSerif)) return GENERIC_SERIF_NAME;
-      return ff.Name;
-    }
-  }
-  #endregion
-
-  #region Array Types
-  [Transformer("FF89F6D1-CDE3-498E-9166-F70AC6EB01F1", 301)]
-  [StorableType("59d8363a-7e6c-4d29-9432-8274acd2145f")]
-  internal sealed class ByteArrayTransformer : ByteArrayBoxTransformer<byte[]> {
-    protected override ByteString ToByteString(byte[] value) {
-      return ByteString.CopyFrom(value);
-    }
-    protected override byte[] FromByteString(ByteString byteString) {
-      return byteString.ToArray();
-    }
-  }
-
-  [Transformer("B49B3F2D-2E97-4BAB-8705-8D29DA707C6A", 302)]
-  [StorableType("304c7463-4575-481b-8922-6a54957305c7")]
-  internal sealed class SByteArrayTransformer : ByteArrayBoxTransformer<sbyte[]> {
-    protected override ByteString ToByteString(sbyte[] value) {
-      return ByteString.CopyFrom(value.Select(b => (byte)b).ToArray());
-    }
-    protected override sbyte[] FromByteString(ByteString byteString) {
-      return byteString.Select(b => (sbyte)b).ToArray();
-    }
-  }
-
-  [Transformer("F25A73B2-6B67-4493-BD59-B836AF4455D1", 300)]
-  [StorableType("06fdb68c-ec5e-4cb5-9ad1-063fca0b9c2e")]
-  internal sealed class BoolArrayTransformer : BoolArrayBoxTransformer<bool[]> {
-    protected override IEnumerable<bool> ToBoxType(bool[] value, Mapper mapper) { return value; }
-    protected override bool[] ToValueType(IEnumerable<bool> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("2811FDD4-6800-4CBA-86D7-9071ED5775ED", 303)]
-  [StorableType("832d8971-51b1-4264-b7eb-07d6e836bf7b")]
-  internal sealed class ShortArrayTransformer : ByteArrayBoxTransformer<short[]> {
-    protected override ByteString ToByteString(short[] value) {
-      var res = new byte[value.Length * 2];
-      for (int i = 0; i < value.Length; i++) {
-        var bytes = BitConverter.GetBytes(value[i]);
-        Array.Copy(bytes, 0, res, i * 2, 2);
-      }
-      return ByteString.CopyFrom(res);
-    }
-    protected override short[] FromByteString(ByteString byteString) {
-      var bytes = byteString.ToArray();
-      var res = new short[bytes.Length / 2];
-      for (int i = 0; i < bytes.Length; i += 2) {
-        res[i / 2] = BitConverter.ToInt16(bytes, i);
-      }
-      return res;
-    }
-  }
-
-  [Transformer("1AAC2625-356C-40BC-8CB4-15CB3D047EB8", 304)]
-  [StorableType("c303b4cf-ffd0-47e2-9d94-07f2d558d17f")]
-  internal sealed class UShortArrayTransformer : ByteArrayBoxTransformer<ushort[]> {
-    protected override ByteString ToByteString(ushort[] value) {
-      var res = new byte[value.Length * 2];
-      for (int i = 0; i < value.Length; i++) {
-        var bytes = BitConverter.GetBytes(value[i]);
-        Array.Copy(bytes, 0, res, i * 2, 2);
-      }
-      return ByteString.CopyFrom(res);
-    }
-    protected override ushort[] FromByteString(ByteString byteString) {
-      var bytes = byteString.ToArray();
-      var res = new ushort[bytes.Length / 2];
-      for (int i = 0; i < bytes.Length; i += 2) {
-        res[i / 2] = BitConverter.ToUInt16(bytes, i);
-      }
-      return res;
-    }
-  }
-
-  [Transformer("12F19098-5D49-4C23-8897-69087F1C146D", 305)]
-  [StorableType("55f7c8b0-f2aa-4830-857d-6ce2807da138")]
-  internal sealed class CharArrayTransformer : ByteArrayBoxTransformer<char[]> {
-    protected override ByteString ToByteString(char[] value) {
-      var res = new byte[value.Length * 2];
-      for (int i = 0; i < value.Length; i++) {
-        var bytes = BitConverter.GetBytes(value[i]);
-        Array.Copy(bytes, 0, res, i * 2, 2);
-      }
-      return ByteString.CopyFrom(res);
-    }
-    protected override char[] FromByteString(ByteString byteString) {
-      var bytes = byteString.ToArray();
-      var res = new char[bytes.Length / 2];
-      for (int i = 0; i < bytes.Length; i += 2) {
-        res[i / 2] = BitConverter.ToChar(bytes, i);
-      }
-      return res;
-    }
-  }
-
-  [Transformer("5F6DC3BC-4433-4AE9-A636-4BD126F7DACD", 306)]
-  [StorableType("e7089621-5236-4d37-a592-c8a0816c59fa")]
-  internal sealed class IntArrayTransformer : IntArrayBoxTransformer<int[]> {
-    protected override IEnumerable<int> ToBoxType(int[] value, Mapper mapper) { return value; }
-    protected override int[] ToValueType(IEnumerable<int> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("3F10274F-D350-4C82-89EA-A5EB36D4EFCC", 307)]
-  [StorableType("0972d235-5e21-4abf-84f8-aad1bbfdff40")]
-  internal sealed class UIntArrayTransformer : UnsignedIntArrayBoxTransformer<uint[]> {
-    protected override IEnumerable<uint> ToBoxType(uint[] value, Mapper mapper) { return value; }
-    protected override uint[] ToValueType(IEnumerable<uint> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("E9D550E2-57F7-47F3-803D-37A619DA1A5C", 308)]
-  [StorableType("0c656d5d-11dc-4a75-895a-06701048cd70")]
-  internal sealed class LongArrayTransformer : LongArrayBoxTransformer<long[]> {
-    protected override IEnumerable<long> ToBoxType(long[] value, Mapper mapper) { return value; }
-    protected override long[] ToValueType(IEnumerable<long> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("C02A205B-2176-4282-AC2B-ADEF96DDBE24", 309)]
-  [StorableType("c5f87514-a6c1-400b-9a6c-8adcf980f701")]
-  internal sealed class ULongArrayTransformer : UnsignedLongArrayBoxTransformer<ulong[]> {
-    protected override IEnumerable<ulong> ToBoxType(ulong[] value, Mapper mapper) { return value; }
-    protected override ulong[] ToValueType(IEnumerable<ulong> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("3C4590D9-C76E-4AFB-98FD-E50D3D051648", 310)]
-  [StorableType("ecc63624-1b78-4bef-8326-74c1a43078ff")]
-  internal sealed class FloatArrayTransformer : FloatArrayBoxTransformer<float[]> {
-    protected override IEnumerable<float> ToBoxType(float[] value, Mapper mapper) { return value; }
-    protected override float[] ToValueType(IEnumerable<float> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("FB98C399-9323-4470-9A85-9186C2B2D5D4", 311)]
-  [StorableType("03025baa-f57a-48de-b0e2-8e6dc10740ee")]
-  internal sealed class DoubleArrayTransformer : DoubleArrayBoxTransformer<double[]> {
-    protected override IEnumerable<double> ToBoxType(double[] value, Mapper mapper) { return value; }
-    protected override double[] ToValueType(IEnumerable<double> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("68332513-9CF1-47FA-A093-6DDB663186EC", 312)]
-  [StorableType("791ea34d-e071-4ef2-812b-eb8e2faced45")]
-  internal sealed class StringArrayTransformer : StringArrayBoxTransformer<string[]> {
-    protected override IEnumerable<string> ToBoxType(string[] value, Mapper mapper) { return value; }
-    protected override string[] ToValueType(IEnumerable<string> value, Type type, Mapper mapper) { return value.ToArray(); }
-  }
-
-  [Transformer("B01ADF0A-ACAA-444E-9F82-0C7C2AF1F490", 400)]
-  [StorableType("56ae4f46-9fc1-4243-a07f-7b7c24e30545")]
-  internal sealed class ArrayTransformer : Transformer {
-    public override bool CanTransformType(Type type) {
-      return type.IsArray;
-    }
-    public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      Populate(box, o, mapper);
-      return box.Build();
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
-      var type = value.GetType();
-      var array = (Array)value;
-      var rank = array.Rank;
-
-      var uIntArrayBox = UnsignedIntArrayBox.CreateBuilder();
-      uIntArrayBox.AddValues(mapper.GetBoxId(rank));
-
-      int[] lengths = new int[rank];
-      int[] lowerBounds = new int[rank];
-      for (int i = 0; i < rank; i++) {
-        lengths[i] = array.GetLength(i);
-        lowerBounds[i] = array.GetLowerBound(i);
-      }
-
-      uIntArrayBox.AddRangeValues(lengths.Select(x => mapper.GetBoxId(x)));
-      uIntArrayBox.AddRangeValues(lowerBounds.Select(x => mapper.GetBoxId(x)));
-
-      int[] positions = (int[])lowerBounds.Clone();
-      while (positions[rank - 1] < lengths[rank - 1] + lowerBounds[rank - 1]) {
-        uIntArrayBox.AddValues(mapper.GetBoxId(array.GetValue(positions)));
-        positions[0] += 1;
-        for (int i = 0; i < rank - 1; i++) {
-          if (positions[i] >= lowerBounds[i] + lengths[i]) {
-            positions[i] = lowerBounds[i];
-            positions[i + 1] += 1;
-          } else {
-            break;
-          }
+        version++;
+      }
+      if (version != typeInfo.StorableTypeAttribute.Version)
+        throw new PersistenceException(string.Format("Missing one or more conversion methods for type {0} version {1}",
+          typeGuid, typeInfo.StorableTypeAttribute.Version));
+
+      // set default values for all fields and properties
+      foreach (var componentInfo in typeInfo.Fields) {
+        var field = (FieldInfo)componentInfo.MemberInfo;
+        if (componentInfo.StorableAttribute != null && componentInfo.StorableAttribute.DefaultValue != null)
+          field.SetValue(obj, componentInfo.StorableAttribute.DefaultValue);
+      }
+      foreach (var componentInfo in typeInfo.Properties.Where(x => x.Writeable)) {
+        var property = (PropertyInfo)componentInfo.MemberInfo;
+        if (componentInfo.StorableAttribute != null && componentInfo.StorableAttribute.DefaultValue != null)
+          property.SetValue(obj, componentInfo.StorableAttribute.DefaultValue, null);
+      }
+
+      // set all members as generated by conversion method chain
+      foreach (var kvp in dict) {
+        var key = kvp.Key;
+        var val = kvp.Value;
+        var fieldInfo = typeInfo.Fields.FirstOrDefault(fi => fi.Name == key);
+        if (fieldInfo != null) {
+          var field = (FieldInfo)fieldInfo.MemberInfo;
+          field.SetValue(obj, val);
+          lastDict.Remove(fieldInfo.Name); // only for consistency check
+          continue;
         }
-      }
-
-      box.TypeId = mapper.GetBoxId(type);
-      box.SetExtension(UnsignedIntArrayBox.UnsignedIntArray, uIntArrayBox.Build());
-    }
-    public override object ToObject(Box box, Mapper mapper) {
-      var uIntArrayBox = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var rank = (int)mapper.GetObject(uIntArrayBox.GetValues(0));
-
-      int[] lengths = new int[rank], lowerBounds = new int[rank];
-      for (int i = 0; i < rank; i++)
-        lengths[i] = (int)mapper.GetObject(uIntArrayBox.GetValues(i + 1));
-      for (int i = 0; i < rank; i++)
-        lowerBounds[i] = (int)mapper.GetObject(uIntArrayBox.GetValues(i + 1 + rank));
-
-      var type = (Type)mapper.GetObject(box.TypeId);
-      return Array.CreateInstance(type.GetElementType(), lengths, lowerBounds);
-    }
-    public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var array = (Array)obj;
-      var uIntArrayBox = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var rank = (int)mapper.GetObject(uIntArrayBox.GetValues(0));
-
-      int[] lengths = new int[rank], lowerBounds = new int[rank];
-      for (int i = 0; i < rank; i++)
-        lengths[i] = (int)mapper.GetObject(uIntArrayBox.GetValues(i + 1));
-      for (int i = 0; i < rank; i++)
-        lowerBounds[i] = (int)mapper.GetObject(uIntArrayBox.GetValues(i + 1 + rank));
-
-      int[] positions = (int[])lowerBounds.Clone();
-      var e = uIntArrayBox.ValuesList.Skip(1 + 2 * rank).GetEnumerator();
-      while (e.MoveNext()) {
-        int[] currentPositions = positions;
-        array.SetValue(mapper.GetObject(e.Current), currentPositions);
-        positions[0] += 1;
-        for (int i = 0; i < rank - 1; i++) {
-          if (positions[i] >= lengths[i] + lowerBounds[i]) {
-            positions[i] = lowerBounds[i];
-            positions[i + 1] += 1;
-          } else {
-            break;
-          }
+        var propInfo = typeInfo.Properties.Where(x => x.Writeable).FirstOrDefault(pi => pi.Name == key);
+        if (propInfo != null) {
+          var prop = (PropertyInfo)propInfo.MemberInfo;
+          prop.SetValue(obj, val, null);
+          lastDict.Remove(propInfo.Name);    // only for consistency check
+          continue;
         }
       }
-    }
-  }
-  #endregion
-
-  [Transformer("4FA5EAAF-ECC7-4A9C-84E7-6583DA96F3B9", 500)]
-  [StorableType("b19c0fe5-6bba-4492-af91-c111edce77dc")]
-  internal sealed class EnumerableTransformer : Transformer {
-    private static readonly HashSet<Type> supportedTypes = new HashSet<Type> {
-      typeof(Stack<>), typeof(Stack),
-      typeof(Queue<>), typeof(Queue),
-      typeof(HashSet<>),
-      typeof(List<>), typeof(ArrayList)
-    };
-    public override bool CanTransformType(Type type) {
-      return type.IsGenericType && supportedTypes.Contains(type.GetGenericTypeDefinition()) || supportedTypes.Contains(type);
-    }
-    public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      Populate(box, o, mapper);
-      return box.Build();
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
-      var uIntArrayBox = UnsignedIntArrayBox.CreateBuilder();
-
-      var type = value.GetType();
-      var propertyInfo = type.GetProperty("Comparer");
-      if (propertyInfo != null) {
-        // TODO: where to store id for comparer box? (atm: first element in int array ...)
-        var comparer = propertyInfo.GetValue(value);
-        var comparerType = comparer.GetType();
-        if (StorableTypeAttribute.IsStorableType(comparerType))
-          uIntArrayBox.AddValues(mapper.GetBoxId(comparer));
-        else if (comparerType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Any())
-          throw new NotSupportedException("Cannot serialize non-storable equality comparers with fields");
-        else
-          uIntArrayBox.AddValues(mapper.GetBoxId(comparerType));
-      }
-
-      foreach (var item in (IEnumerable)value)
-        uIntArrayBox.AddValues(mapper.GetBoxId(item));
-
-      box.TypeId = mapper.GetBoxId(type);
-      box.SetExtension(UnsignedIntArrayBox.UnsignedIntArray, uIntArrayBox.Build());
-    }
-    public override object ToObject(Box box, Mapper mapper) {
-      var uIntArrayBox = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var type = (Type)mapper.GetObject(box.TypeId);
-      return Activator.CreateInstance(type);
-    }
-    public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var uIntArrayBox = box.GetExtension(UnsignedIntArrayBox.UnsignedIntArray);
-      var elements = uIntArrayBox.ValuesList.Select(mapper.GetObject);
-      var type = obj.GetType();
-
-      string methodName = string.Empty;
-      if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Stack<>) || type == typeof(Stack)) {
-        elements = elements.Reverse();
-        methodName = "Push";
-      } else if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Queue<>) || type == typeof(Queue)) {
-        methodName = "Enqueue";
-      } else {
-        methodName = "Add";
-        if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(HashSet<>)) {
-          var fieldInfo = type.GetField("m_comparer", BindingFlags.NonPublic | BindingFlags.Instance);
-          var comparerObj = mapper.GetObject(uIntArrayBox.GetValues(0));
-          var comparer = comparerObj is Type ? Activator.CreateInstance((Type)comparerObj) : comparerObj;
-          fieldInfo.SetValue(obj, comparer);
-          elements = elements.Skip(1);
-        }
-      }
-
-      MethodInfo addMethod = type.GetMethod(methodName);
-      foreach (var e in elements)
-        addMethod.Invoke(obj, new[] { e });
-    }
-  }
-
-  [Transformer("C47A62F5-F113-4A43-A8EE-CF817EC799A2", 501)]
-  [StorableType("ba53df84-dc97-4d8d-a493-868972ed1002")]
-  internal sealed class DictionaryTransformer : Transformer {
-    public override bool CanTransformType(Type type) {
-      return type.IsGenericType && typeof(Dictionary<,>) == type.GetGenericTypeDefinition();
-    }
-    public override Box ToBox(object o, Mapper mapper) {
-      var box = Box.CreateBuilder();
-      box.TransformerId = mapper.GetTransformerId(this);
-      Populate(box, o, mapper);
-      return box.Build();
-    }
-    private void Populate(Box.Builder box, object value, Mapper mapper) {
-      var dictionaryBox = DictionaryBox.CreateBuilder();
-      foreach (DictionaryEntry item in (IDictionary)value) {
-        dictionaryBox.AddKeyIds(mapper.GetBoxId(item.Key));
-        dictionaryBox.AddValueIds(mapper.GetBoxId(item.Value));
-      }
-
-      var type = value.GetType();
-      var propertyInfo = type.GetProperty("Comparer");
-      var comparer = propertyInfo.GetValue(value);
-
-      var comparerType = comparer.GetType();
-      if (StorableTypeAttribute.IsStorableType(comparerType))
-        dictionaryBox.SetComparerId(mapper.GetBoxId(comparer));
-      else if (comparerType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Any())
-        throw new NotSupportedException("Cannot serialize non-storable equality comparers with fields");
-      else
-        dictionaryBox.SetComparerId(mapper.GetBoxId(comparerType));
-
-      box.TypeId = mapper.GetBoxId(type);
-      box.SetExtension(DictionaryBox.Dictionary, dictionaryBox.Build());
-    }
-    public override object ToObject(Box box, Mapper mapper) {
-      var dictionaryBox = box.GetExtension(DictionaryBox.Dictionary);
-      return Activator.CreateInstance((Type)mapper.GetObject(box.TypeId), dictionaryBox.ValueIdsCount);
-    }
-    public override void FillFromBox(object obj, Box box, Mapper mapper) {
-      var type = obj.GetType();
-      var dictionaryBox = box.GetExtension(DictionaryBox.Dictionary);
-      var comparerObj = mapper.GetObject(dictionaryBox.ComparerId);
-      var comparer = comparerObj is Type ? Activator.CreateInstance((Type)comparerObj) : comparerObj;
-
-      var fieldInfo = type.GetField("comparer", BindingFlags.NonPublic | BindingFlags.Instance);
-      fieldInfo.SetValue(obj, comparer);
-
-
-      var addMethod = type.GetMethod("Add");
-      for (int i = 0; i < dictionaryBox.KeyIdsCount; i++) {
-        var key = mapper.GetObject(dictionaryBox.GetKeyIds(i));
-        var value = mapper.GetObject(dictionaryBox.GetValueIds(i));
-        addMethod.Invoke(obj, new[] { key, value });
+
+      if (lastDict.Any())
+        throw new PersistenceException(string.Format("Invalid conversion method. The following members are undefined in type {0} version {1}: {2}",
+          typeGuid, typeInfo.StorableTypeAttribute.Version,
+          string.Join(", ", lastDict.Keys)));
+
+      var emptyArgs = new object[0];
+      foreach (var hook in typeInfo.AfterDeserializationHooks) {
+        hook.Invoke(obj, emptyArgs);
       }
     }
Index: /branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs
===================================================================
--- /branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs	(revision 15508)
+++ /branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs	(revision 15509)
@@ -30,8 +30,6 @@
 using System.Reflection;
 using System.Text;
-using System.Threading;
 using System.Threading.Tasks;
 using HeuristicLab.Algorithms.GeneticAlgorithm;
-using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
@@ -39,5 +37,4 @@
 using HeuristicLab.Persistence.Auxiliary;
 using HeuristicLab.Persistence.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.Persistence.Default.DebugString;
 using HeuristicLab.Persistence.Default.Xml;
@@ -2210,5 +2207,5 @@
 
       [Storable(Name = "s", AllowOneWay = true)]
-      public string StorableString {  set { PublicString = value; } }
+      public string StorableString { set { PublicString = value; } }
       public string PublicString { get; set; }
     }
@@ -2284,5 +2281,5 @@
       var restored = (V3)o;
       Assert.AreEqual(restored.a, old.a.Value);
-      Assert.IsTrue(restored.val.SequenceEqual(old.vals.Select(iv=>iv.Value)));
+      Assert.IsTrue(restored.val.SequenceEqual(old.vals.Select(iv => iv.Value)));
       Assert.IsTrue(restored.items.Select(item => item.Value).SequenceEqual(old.items.Select(iv => (double)((dynamic)iv).Value)));
       // Assert.AreSame(restored.items[0], restored.items[1]);
@@ -2327,5 +2324,5 @@
     [TestProperty("Time", "short")]
     public void TestLoadingSamples() {
-      var path = @"D:\hl\branches\PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents";
+      var path = @"D:\Dev\Software_HL\branches\PersistenceReintegration\HeuristicLab.Optimizer\3.3\Documents";
       var serializer = new ProtoBufSerializer();
       foreach (var fileName in Directory.EnumerateFiles(path, "*.hl")) {
@@ -2351,4 +2348,5 @@
           serializer.Serialize(original, fileName + ".proto");
           // var newVersion = serializer.Deserialize(fileName + ".proto");
+          Console.WriteLine("File: " + fileName);
           var p = Profile(() => original);
           Console.WriteLine(p);
