Index: branches/New Persistence Exploration/Persistence/Persistence.sln
===================================================================
--- branches/New Persistence Exploration/Persistence/Persistence.sln	(revision 1247)
+++ branches/New Persistence Exploration/Persistence/Persistence.sln	(revision 1247)
@@ -0,0 +1,34 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Persistence", "Persistence\Persistence.csproj", "{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Core", "..\..\..\hl3\core\trunk\sources\HeuristicLab.Core\HeuristicLab.Core.csproj", "{F43B59AB-2B8C-4570-BC1E-15592086517C}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x86 = Debug|x86
+		Release|Any CPU = Release|Any CPU
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}.Release|x86.ActiveCfg = Release|Any CPU
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Debug|x86.ActiveCfg = Debug|x86
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Debug|x86.Build.0 = Debug|x86
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Release|x86.ActiveCfg = Release|x86
+		{F43B59AB-2B8C-4570-BC1E-15592086517C}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
Index: branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttribute.cs
===================================================================
--- branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttribute.cs	(revision 1247)
+++ branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttribute.cs	(revision 1247)
@@ -0,0 +1,131 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+namespace Persistence {
+
+  [AttributeUsage(
+    AttributeTargets.Field | AttributeTargets.Property,
+    AllowMultiple=false,
+    Inherited=false)]
+  public class AutoStorableAttribute : Attribute {
+
+    private string name = null;
+    private object defaultValue = null;
+
+    public string Name {
+      get { return this.name; }
+      set { this.name = value; }
+    }
+
+    public object DefaultValue {
+      get { return this.defaultValue; }
+      set { this.defaultValue = value; }
+    }  
+
+    private const BindingFlags instanceMembers =
+      BindingFlags.Instance |
+      BindingFlags.Public |
+      BindingFlags.NonPublic;
+
+    public static Dictionary<string, DataMemberAccessor> GetAutostorableAccessors(object obj) {
+      Dictionary<string, DataMemberAccessor> autoStorableAccessors = 
+        new Dictionary<string, DataMemberAccessor>();
+      foreach (MemberInfo memberInfo in obj.GetType().GetMembers(instanceMembers)) {
+        foreach (object attribute in memberInfo.GetCustomAttributes(false)) {          
+          AutoStorableAttribute autoStorableAttribute =
+            attribute as AutoStorableAttribute;
+          if (autoStorableAttribute != null) {
+            autoStorableAccessors.Add(memberInfo.Name,
+              new DataMemberAccessor(memberInfo, autoStorableAttribute, obj));
+          }
+        }
+      }
+      return autoStorableAccessors;
+    }    
+  }
+
+  public interface IDataMemberAccessor {
+    string Name { get; }
+    Type Type { get; }
+    object DefaultValue { get; }
+    object Get();
+    void Set(object value);    
+  }
+    
+  public class DataMemberAccessor : IDataMemberAccessor {
+
+    public delegate object Getter();
+    public delegate void Setter(object value);
+
+    private string name;
+    private Type type;
+    private object defaultValue;
+    private Getter getter;
+    private Setter setter;
+
+    public DataMemberAccessor(
+        MemberInfo memberInfo,
+        AutoStorableAttribute autoStorableAttribute,
+        object obj) {
+      if (memberInfo.MemberType == MemberTypes.Field) {
+        this.getter = () => ((FieldInfo)memberInfo).GetValue(obj);
+        this.setter = (value) => ((FieldInfo)memberInfo).SetValue(obj, value);
+      } else if (memberInfo.MemberType == MemberTypes.Property) {
+        this.getter = () => ((PropertyInfo)memberInfo).GetValue(obj, null);
+        this.setter = (value) => ((PropertyInfo)memberInfo).SetValue(obj, value, null);
+      } else {
+        throw new NotSupportedException(
+                "The AutoStorable attribute can only be applied to fields and properties.\n" +
+                "However, it was applied to a member of type " + memberInfo.MemberType.ToString());
+      }      
+      this.name = autoStorableAttribute.Name != null ? autoStorableAttribute.Name : memberInfo.Name;
+      this.type = memberInfo.ReflectedType;
+      this.defaultValue = autoStorableAttribute.DefaultValue;                  
+    }
+
+    public DataMemberAccessor(
+        string name, Type type, object defaultValue,
+        Getter getter, Setter setter) {
+      this.name = name;
+      this.type = type;
+      this.defaultValue = defaultValue;
+      this.getter = getter;
+      this.setter = setter;
+    }
+
+    public string Name {
+      get { return this.name; }
+    }
+
+    public Type Type {
+      get { return this.type; }
+    }
+
+    public object DefaultValue {
+      get { return this.defaultValue; }
+    }
+
+    public object Get() {
+      return this.getter();
+    }
+
+    public void Set(object value) {
+      this.setter(value);
+    }
+
+    public override string ToString() {
+      return String.Format("Property({0}, {1}, {2}, {3}, {4}",
+        this.name,
+        this.type == null ? "<null>" : this.type.FullName,
+        this.defaultValue == null ? "<null>" : this.defaultValue,
+        this.getter.Method,
+        this.setter.Method);
+    }
+  }
+
+
+  
+
+}
Index: branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttributeTests.cs
===================================================================
--- branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttributeTests.cs	(revision 1247)
+++ branches/New Persistence Exploration/Persistence/Persistence/AutoStorableAttributeTests.cs	(revision 1247)
@@ -0,0 +1,41 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Persistence {
+
+  class TestClass {
+
+    [AutoStorable(Name="TestProperty", DefaultValue=12)]
+    public object o;
+
+    [AutoStorable]
+    public int x = 2;
+
+    public int y;
+
+  }
+
+  class AttributeTest {
+
+    static void Main() {
+      TestClass t = new TestClass();
+      Dictionary<string, DataMemberAccessor> accessors = AutoStorableAttribute.GetAutostorableAccessors(t);
+      foreach ( KeyValuePair<string, DataMemberAccessor> pair in accessors ) {
+        Console.WriteLine(pair.Key + ": " + pair.Value.ToString());
+      }
+      t.o = new Object();
+      t.x = 12;
+      t.y = 312890;
+      accessors["o"].Set(null);
+      accessors["x"].Set(123);
+      try {
+        accessors["y"].Set(0);
+        throw new InvalidOperationException();
+      } catch ( KeyNotFoundException ) { }
+      Console.ReadLine();
+    }
+
+  }
+
+}
Index: branches/New Persistence Exploration/Persistence/Persistence/Persistence.csproj
===================================================================
--- branches/New Persistence Exploration/Persistence/Persistence/Persistence.csproj	(revision 1247)
+++ branches/New Persistence Exploration/Persistence/Persistence/Persistence.csproj	(revision 1247)
@@ -0,0 +1,56 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Persistence</RootNamespace>
+    <AssemblyName>Persistence</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <StartupObject>Persistence.SerializationTest</StartupObject>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AutoStorableAttributeTests.cs" />
+    <Compile Include="AutoStorableAttribute.cs" />
+    <Compile Include="PersistenceManager.cs" />
+    <Compile Include="SerializationTest.cs" />
+  </ItemGroup>
+</Project>
