Index: /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Mapper.cs
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Mapper.cs	(revision 13357)
+++ /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Mapper.cs	(revision 13358)
@@ -29,11 +29,21 @@
 namespace HeuristicLab.Persistence {
   public sealed class Mapper {
+    private static StaticCache staticCache = null;
+    private static object locker = new object();
+    public static StaticCache StaticCache {
+      get {
+        lock (locker) {
+          if (staticCache == null) staticCache = new StaticCache();
+          return staticCache;
+        }
+      }
+    }
+
     private Index<ITransformer> transformers;
-    private Dictionary<Type, TypeInfo> typeInfos;
     private Index<Type> types;
     private Index<string> strings;
     private Index<Box> boxes;
-    private Dictionary<object, uint> boxCache;
-    private Dictionary<uint, object> objectCache;
+    private Dictionary<object, uint> object2BoxId;
+    private Dictionary<uint, object> boxId2object;
 
     public long BoxCount { get; private set; }
@@ -41,32 +51,18 @@
     public Mapper() {
       transformers = new Index<ITransformer>();
-      typeInfos = new Dictionary<Type, TypeInfo>();
       types = new Index<Type>();
       strings = new Index<string>();
       boxes = new Index<Box>();
-      boxCache = new Dictionary<object, uint>(new ReferenceEqualityComparer<object>());
-      objectCache = new Dictionary<uint, object>();
+      object2BoxId = new Dictionary<object, uint>(new ReferenceEqualityComparer<object>());
+      boxId2object = new Dictionary<uint, object>();
 
       BoxCount = 0;
-
-      foreach (var transformer in ApplicationManager.Manager.GetInstances<ITransformer>().OrderBy(x => x.Order)) {
-        transformer.Initialize(transformers.GetIndex(transformer));
-      }
     }
 
-    public TypeInfo GetTypeInfo(Type type) {
-      TypeInfo typeInfo;
-      if (!typeInfos.TryGetValue(type, out typeInfo)) {
-        var transformer = transformers.GetValues().Where(x => x.CanTransformType(type)).FirstOrDefault();
-        typeInfo = new TypeInfo(type, transformer);
-        typeInfos.Add(type, typeInfo);
-      }
-      return typeInfo;
+    public uint GetTransformerId(ITransformer transformer) {
+      return transformers.GetIndex(transformer);
     }
-    public IEnumerable<TypeInfo> GetTypeInfos() {
-      return typeInfos.Values;
-    }
-    public IEnumerable<Type> GetTypes() {
-      return typeInfos.Values.Select(x => x.Type);
+    public ITransformer GetTransformer(uint transformerId) {
+      return transformers.GetValue(transformerId);
     }
 
@@ -87,5 +83,5 @@
     public uint GetBoxId(object o) {
       uint boxId;
-      if (boxCache.TryGetValue(o, out boxId)) return boxId;
+      if (object2BoxId.TryGetValue(o, out boxId)) return boxId;
 
       if (o == null)
@@ -93,5 +89,5 @@
       else {
         var type = o.GetType();
-        var typeInfo = GetTypeInfo(type);
+        var typeInfo = StaticCache.GetTypeInfo(type);
         if (typeInfo.Transformer == null) throw new ArgumentException("Cannot serialize object of type " + o.GetType());
         BoxCount++;
@@ -99,10 +95,10 @@
         boxId = boxes.GetIndex(typeInfo.Transformer.ToBox(o, this));
       }
-      boxCache.Add(o, boxId);
+      object2BoxId.Add(o, boxId);
       return boxId;
     }
     public object GetObject(uint boxId) {
       object o;
-      if (objectCache.TryGetValue(boxId, out o)) return o;
+      if (boxId2object.TryGetValue(boxId, out o)) return o;
 
       var box = this.boxes.GetValue(boxId);
@@ -113,10 +109,10 @@
         o = transformer.ToObject(box, this);
       }
-      objectCache.Add(boxId, o);
+      boxId2object.Add(boxId, o);
       return o;
     }
 
     public object CreateInstance(Type type) {
-      return GetTypeInfo(type).GetConstructor()();
+      return StaticCache.GetTypeInfo(type).GetConstructor()();
     }
 
@@ -126,5 +122,5 @@
       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 => mapper.typeInfos[x].StorableClassAttribute.Guid).Select(x => ByteString.CopyFrom(x.ToByteArray())));
+      bundle.AddRangeTypeGuids(mapper.types.GetValues().Select(x => StaticCache.GetGuid(x)).Select(x => ByteString.CopyFrom(x.ToByteArray())));
       bundle.AddRangeStrings(mapper.strings.GetValues());
       bundle.AddRangeBoxes(mapper.boxes.GetValues());
@@ -132,18 +128,9 @@
     }
     public static object ToObject(Bundle bundle) {
-      var types = new Dictionary<Guid, Type>();
-      foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
-        foreach (var t in asm.GetTypes().Where(x => StorableClassAttribute.IsStorableClass(x)))
-          types.Add(StorableClassAttribute.GetStorableClassAttribute(t).Guid, t);
-      }
-
       var mapper = new Mapper();
-      mapper.types = new Index<Type>(bundle.TypeGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => types[x]));
+      mapper.types = new Index<Type>(bundle.TypeGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => StaticCache.GetType(x)));
       mapper.strings = new Index<string>(bundle.StringsList);
       mapper.boxes = new Index<Box>(bundle.BoxesList);
-      mapper.transformers = new Index<ITransformer>(bundle.TransformerGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => mapper.transformers.GetValues().First(y => y.Guid == x)));
-      foreach (var type in mapper.types.GetValues())
-        mapper.typeInfos.Add(type, new TypeInfo(type));
-
+      mapper.transformers = new Index<ITransformer>(bundle.TransformerGuidsList.Select(x => new Guid(x.ToByteArray())).Select(x => StaticCache.GetTransformer(x)));
       return mapper.GetObject(bundle.RootBoxId);
     }
Index: /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StaticCache.cs
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StaticCache.cs	(revision 13358)
+++ /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/StaticCache.cs	(revision 13358)
@@ -0,0 +1,107 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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 HeuristicLab.PluginInfrastructure;
+using Google.ProtocolBuffers;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Persistence {
+  public sealed class StaticCache {
+    private static 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;
+
+    internal StaticCache() {
+      Initialize();
+    }
+    public void Initialize() {
+      lock (locker) {
+        guid2Transformer = new Dictionary<Guid, ITransformer>();
+        transformer2Guid = new Dictionary<ITransformer, Guid>();
+        guid2Type = new Dictionary<Guid, Type>();
+        type2Guid = new Dictionary<Type, Guid>();
+        typeInfos = new Dictionary<Type, TypeInfo>();
+
+        foreach (var transformer in ApplicationManager.Manager.GetInstances<ITransformer>().OrderBy(x => x.Order)) {
+          guid2Transformer.Add(transformer.Guid, transformer);
+          transformer2Guid.Add(transformer, transformer.Guid);
+        }
+
+        RegisterType(new Guid("94AD8522-3F55-4580-A6F8-2D2AAEDD4B8C"), typeof(bool));
+        RegisterType(new Guid("4A1C0FD5-423D-4F96-AB22-A496578C25AC"), typeof(byte));
+        RegisterType(new Guid("C4B00F0B-FED7-439F-B1B2-8A0048B64882"), typeof(sbyte));
+        RegisterType(new Guid("9F451811-3DE1-43AB-8B74-D7E03851857B"), typeof(short));
+        RegisterType(new Guid("46244D54-0145-49F7-9CF3-9CDB7FB5F240"), typeof(ushort));
+        RegisterType(new Guid("1FDDE40C-09E3-491F-8FBB-32BB3C885E9E"), typeof(char));
+        RegisterType(new Guid("EE3E0F9C-A5C2-4461-AF36-28BD8F26E6FB"), typeof(int));
+        RegisterType(new Guid("69476D18-D285-43E9-BC7C-6CC9E9F2321E"), typeof(uint));
+        RegisterType(new Guid("7C7BC5EC-F001-4BA0-9F85-50DCBAA9AE81"), typeof(long));
+        RegisterType(new Guid("AC808D5A-63BB-457C-9B92-C9B83DA2B139"), typeof(ulong));
+        RegisterType(new Guid("BF22653A-026C-4367-BBBA-2125AECF6C08"), typeof(float));
+        RegisterType(new Guid("8B49821A-3ADC-4715-9DB1-08E2F3CFDF15"), typeof(double));
+        RegisterType(new Guid("7BB386BF-6FD4-443D-A6C1-387096798C67"), typeof(DateTime));
+        RegisterType(new Guid("724A2D49-7E7B-455B-BBA9-4214C64E8A21"), typeof(TimeSpan));
+        foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) {
+          foreach (var t in asm.GetTypes().Where(x => StorableClassAttribute.IsStorableClass(x)))
+            RegisterType(StorableClassAttribute.GetStorableClassAttribute(t).Guid, t);
+        }
+      }
+    }
+
+    public void RegisterType(Guid guid, Type type) {
+      lock (locker) {
+        guid2Type.Add(guid, type);
+        type2Guid.Add(type, guid);
+      }
+    }
+
+    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) {
+        TypeInfo typeInfo;
+        if (!typeInfos.TryGetValue(type, out typeInfo)) {
+          var transformer = guid2Transformer.Values.First(x => x.CanTransformType(type));
+          typeInfo = new TypeInfo(type, transformer);
+          typeInfos.Add(type, typeInfo);
+        }
+        return typeInfo;
+      }
+    }
+  }
+}
Index: /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Transformer.cs
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Transformer.cs	(revision 13357)
+++ /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Core/Transformer.cs	(revision 13358)
@@ -23,5 +23,5 @@
 
 namespace HeuristicLab.Persistence {
-  internal abstract class Transformer : ITransformer {
+  public abstract class Transformer : ITransformer {
     public Guid Guid { get; private set; }
     public uint Id { get; private set; }
Index: /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj	(revision 13357)
+++ /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/HeuristicLab.Persistence-4.0.csproj	(revision 13358)
@@ -44,8 +44,10 @@
     <Reference Include="System.Core" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Core\ComponentInfo.cs" />
     <Compile Include="Core\Index.cs" />
+    <Compile Include="Core\StaticCache.cs" />
     <Compile Include="Core\Mapper.cs" />
     <Compile Include="Core\ProtoBufSerializer.cs" />
@@ -60,4 +62,5 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Protos\PersistenceMessages.cs" />
+    <Compile Include="Transformers\Transformers.cs" />
   </ItemGroup>
   <ItemGroup>
Index: /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs	(revision 13358)
+++ /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/Transformers.cs	(revision 13358)
@@ -0,0 +1,271 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2015 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.Drawing;
+
+namespace HeuristicLab.Persistence {
+  public abstract class BoxTransformer<T> : Transformer {
+    public override bool CanTransformType(Type type) {
+      return type == typeof(T);
+    }
+
+    public override Box ToBox(object o, Mapper mapper) {
+      var box = Box.CreateBuilder();
+      box.TransformerId = mapper.GetTransformerId(this);
+      box.TypeId = mapper.GetTypeId(o.GetType());
+      Populate(box, (T)o, mapper);
+      return box.Build();
+    }
+    public override object ToObject(Box box, Mapper mapper) {
+      return Extract(box, mapper.GetType(box.TypeId), mapper);
+    }
+    protected abstract void Populate(Box.Builder box, T value, Mapper mapper);
+    protected abstract T Extract(Box box, Type type, Mapper mapper);
+  }
+
+  #region Scalar Value Boxes
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  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);
+  }
+  #endregion
+
+  #region Primitive Value Types
+  [Transformer("9FA1C6A8-517E-4623-AC1B-7E9AEF6ED13D", 200)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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)]
+  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", 213)]
+  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", 214)]
+  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); }
+  }
+  #endregion
+
+  #region String
+  [Transformer("E75A594C-0034-4DAB-B28E-8F84F9F6DE8D", 215)]
+  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", 216)]
+  internal sealed class EnumTransformer : UnsignedIntBoxTransformer<object> {
+    public override bool CanTransformType(Type type) {
+      return typeof(Enum).IsAssignableFrom(type);
+    }
+    protected override uint ToBoxType(object value, Mapper mapper) {
+      return mapper.GetStringId(Enum.Format(value.GetType(), value, "G"));
+    }
+    protected override object ToValueType(uint value, Type type, Mapper mapper) {
+      return Enum.Parse(type, mapper.GetString(value));
+    }
+  }
+  #endregion
+
+  #region Color
+  [Transformer("0B540EAC-79AB-40CF-8277-D2C81135FEB6", 217)]
+  internal sealed class ColorTransformers : IntBoxTransformer<Color> {
+    protected override int ToBoxType(Color value, Mapper mapper) { return value.ToArgb(); }
+    protected override Color ToValueType(int value, Type type, Mapper mapper) { return Color.FromArgb(value); }
+  }
+  #endregion
+
+  #region Type
+  [Transformer("8D17FD28-383B-44E9-9BBF-B19D351C5E38", 218)]
+  internal sealed class TypeTransformer : UnsignedIntBoxTransformer<Type> {
+    public override bool CanTransformType(Type type) {
+      return typeof(Type).IsAssignableFrom(type);
+    }
+    protected override uint ToBoxType(Type value, Mapper mapper) { return mapper.GetTypeId(value); }
+    protected override Type ToValueType(uint value, Type type, Mapper mapper) { return mapper.GetType(value); }
+  }
+  #endregion
+}
Index: anches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/ValueTransformer.cs
===================================================================
--- /branches/PersistenceOverhaul/HeuristicLab.Persistence/4.0/Transformers/ValueTransformer.cs	(revision 13357)
+++ 	(revision )
@@ -1,173 +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.Drawing;
-using HeuristicLab.Persistence.Data;
-
-namespace HeuristicLab.Persistence {
-  internal abstract class ValueTransformer<TSource, TTarget> : TransformerBase {
-    public override bool CanTransformType(Type type) {
-      return typeof(TSource) == type;
-    }
-    public override PersistenceData ToData(object o, PersistenceMapper mapper) {
-      return GetTarget((TSource)o, mapper);
-    }
-
-    public override object ToObject(PersistenceData data, PersistenceMapper mapper) {
-      return GetSource((ValueData<TTarget>)data, mapper);
-    }
-
-    protected abstract ValueData<TTarget> GetTarget(TSource source, PersistenceMapper mapper);
-    protected abstract TSource GetSource(ValueData<TTarget> target, PersistenceMapper mapper);
-  }
-
-  internal abstract class ValueTypeTransformer<T> : ValueTransformer<T, T> {
-    protected override ValueData<T> GetTarget(T source, PersistenceMapper mapper) {
-      var data = new ValueData<T>(Id);
-      data.TypeId = mapper.GetTypeId(source.GetType());
-      data.Value = source;
-      return data;
-    }
-    protected override T GetSource(ValueData<T> target, PersistenceMapper mapper) {
-      return target.Value;
-    }
-  }
-
-  #region Primitive Value Types
-  [Transformer("9FA1C6A8-517E-4623-AC1B-7E9AEF6ED13D", 200)]
-  internal sealed class BoolTransformer : ValueTypeTransformer<bool> { }
-
-  [Transformer("059633E9-12CB-43EC-8544-57746536E281", 201)]
-  internal sealed class ByteTransformer : ValueTypeTransformer<byte> { }
-
-  [Transformer("5DC2F3AC-0852-4B57-A861-D29CC814A94C", 202)]
-  internal sealed class SByteTransformer : ValueTypeTransformer<sbyte> { }
-
-  [Transformer("B862E642-A94A-4870-8065-06126A35A9E1", 203)]
-  internal sealed class ShortTransformer : ValueTypeTransformer<short> { }
-
-  [Transformer("D1D3062D-F1BB-4189-AE50-D6986E1DEB4E", 204)]
-  internal sealed class UShortTransformer : ValueTypeTransformer<ushort> { }
-
-  [Transformer("6C444645-3062-4D15-AD01-E6E1B0692A2B", 205)]
-  internal sealed class CharTransformer : ValueTypeTransformer<char> { }
-
-  [Transformer("649E73B2-EFA6-4E01-BCB4-4B29D652C9CB", 206)]
-  internal sealed class IntTransformer : ValueTypeTransformer<int> { }
-
-  [Transformer("BCF25010-81A2-49BC-88CC-407D3F393D5B", 207)]
-  internal sealed class UIntTransformer : ValueTypeTransformer<uint> { }
-
-  [Transformer("B6F6ACAE-755C-47EE-B8BF-7CDECBE19C30", 208)]
-  internal sealed class LongTransformer : ValueTypeTransformer<long> { }
-
-  [Transformer("82333ACA-F041-44E0-B365-27C399594BA7", 209)]
-  internal sealed class ULongTransformer : ValueTypeTransformer<ulong> { }
-
-  [Transformer("8FE91ECF-2261-4934-BECD-C38923B7A703", 210)]
-  internal sealed class FloatTransformer : ValueTypeTransformer<float> { }
-
-  [Transformer("070D23EA-7F38-46B7-A667-219BEF914E49", 211)]
-  internal sealed class DoubleTransformer : ValueTypeTransformer<double> { }
-
-  [Transformer("80368686-0531-4D52-B550-E772B8842E6D", 212)]
-  internal sealed class DecimalTransformer : ValueTypeTransformer<decimal> { }
-
-  [Transformer("BA55C7A6-C91E-4351-A889-E4A7E647F16D", 213)]
-  internal sealed class DateTimeTransformer : ValueTypeTransformer<DateTime> { }
-
-  [Transformer("0C91441B-2D97-432B-B493-D6EC483FC5AD", 214)]
-  internal sealed class TimeSpanTransformer : ValueTypeTransformer<TimeSpan> { }
-  #endregion
-
-  #region String
-  [Transformer("E75A594C-0034-4DAB-B28E-8F84F9F6DE8D", 215)]
-  internal sealed class StringTransformer : ValueTransformer<string, uint> {
-    protected override ValueData<uint> GetTarget(string source, PersistenceMapper mapper) {
-      var data = new ValueData<uint>(Id);
-      mapper.Cache(source, data);
-      data.TypeId = mapper.GetTypeId(source.GetType());
-      data.Value = mapper.GetStringId(source);
-      return data;
-    }
-    protected override string GetSource(ValueData<uint> target, PersistenceMapper mapper) {
-      var source = mapper.GetString(target.Value);
-      mapper.Cache(target, source);
-      return source;
-    }
-  }
-  #endregion
-
-  #region Enum
-  [Transformer("93FF076B-BC4B-4C39-8C40-15E004468C98", 216)]
-  internal sealed class EnumTransformer : ValueTransformer<object, uint> {
-    public override bool CanTransformType(Type type) {
-      return typeof(Enum).IsAssignableFrom(type);
-    }
-    protected override ValueData<uint> GetTarget(object source, PersistenceMapper mapper) {
-      var type = source.GetType();
-      var data = new ValueData<uint>(Id);
-      data.TypeId = mapper.GetTypeId(type);
-      data.Value = mapper.GetStringId(Enum.Format(type, source, "G"));
-      return data;
-    }
-    protected override object GetSource(ValueData<uint> target, PersistenceMapper mapper) {
-      return Enum.Parse(mapper.GetType(target.TypeId), mapper.GetString(target.Value));
-    }
-  }
-  #endregion
-
-  #region Color
-  [Transformer("0B540EAC-79AB-40CF-8277-D2C81135FEB6", 217)]
-  internal sealed class ColorTransformer : ValueTransformer<Color, int> {
-    protected override ValueData<int> GetTarget(Color source, PersistenceMapper mapper) {
-      var data = new ValueData<int>(Id);
-      data.TypeId = mapper.GetTypeId(source.GetType());
-      data.Value = source.ToArgb();
-      return data;
-    }
-    protected override Color GetSource(ValueData<int> target, PersistenceMapper mapper) {
-      return Color.FromArgb(target.Value);
-    }
-  }
-  #endregion
-
-  #region Type
-  [Transformer("8D17FD28-383B-44E9-9BBF-B19D351C5E38", 218)]
-  internal sealed class TypeTransformer : ValueTransformer<Type, ushort> {
-    public override bool CanTransformType(Type type) {
-      return typeof(Type).IsAssignableFrom(type);
-    }
-    protected override ValueData<ushort> GetTarget(Type source, PersistenceMapper mapper) {
-      var data = new ValueData<ushort>(Id);
-      mapper.Cache(source, data);
-      data.Value = mapper.GetTypeId(source);
-      return data;
-    }
-    protected override Type GetSource(ValueData<ushort> target, PersistenceMapper mapper) {
-      var type = mapper.GetType(target.Value);
-      mapper.Cache(target, type);
-      return type;
-    }
-  }
-  #endregion
-}
