Index: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/MetaData.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/MetaData.cs	(revision 2355)
+++ trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/MetaData.cs	(revision 2355)
@@ -0,0 +1,55 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.Database.SQLServerCompact {
+  [Table(Name = "MetaData")]
+  public class MetaData : IMetaData {
+    public MetaData() {
+    }
+
+    public MetaData(string name)
+      : this() {
+      this.name = name;
+    }
+
+    private int id;
+    [Column(Storage = "id", IsPrimaryKey = true, IsDbGenerated = true)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private string name;
+    [Column(Storage = "name", CanBeNull = false)]
+    public string Name {
+      get { return this.name; }
+      private set { this.name = value; }
+    }
+  }
+}
+
Index: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelMetaData.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelMetaData.cs	(revision 2355)
+++ trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelMetaData.cs	(revision 2355)
@@ -0,0 +1,98 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.Database.SQLServerCompact {
+  [Table(Name = "ModelMetaData")]
+  public class ModelMetaData : IModelMetaData {
+    public ModelMetaData() {
+      this.model = default(EntityRef<Model>);
+      this.metadata = default(EntityRef<MetaData>);
+    }
+
+    public ModelMetaData(Model model, MetaData metadata, double value)
+      : this() {
+      this.modelId = model.Id;
+      this.metaDataId = metadata.Id;
+      this.value = value;
+    }
+
+    private double value;
+    [Column(Storage = "value", CanBeNull = false)]
+    public double Value {
+      get { return this.value; }
+      set { this.value = value; }
+    }
+
+    private int modelId;
+    [Column(Storage = "modelId", IsPrimaryKey = true, CanBeNull = false)]
+    public int ModelId {
+      get { return this.modelId; }
+      private set {
+        if (modelId != value) {
+          if (model.HasLoadedOrAssignedValue)
+            throw new ForeignKeyReferenceAlreadyHasValueException();
+        }
+        modelId = value;
+      }
+    }
+
+    private EntityRef<Model> model;
+    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
+    public Model Model {
+      get { return this.model.Entity; }
+    }
+
+    IModel IModelMetaData.Model {
+      get { return this.Model; }
+    }
+
+    private int metaDataId;
+    [Column(Storage = "metaDataId", IsPrimaryKey = true, CanBeNull = false)]
+    public int MetaDataId {
+      get { return this.metaDataId; }
+      private set {
+        if (metaDataId != value) {
+          if (metadata.HasLoadedOrAssignedValue)
+            throw new ForeignKeyReferenceAlreadyHasValueException();
+        }
+        modelId = value;
+      }
+    }
+
+    private EntityRef<MetaData> metadata;
+    [Association(Storage = "metadata", ThisKey = "MetaDataId", OtherKey = "Id", IsForeignKey = true)]
+    public MetaData MetaData {
+      get { return this.metadata.Entity; }
+    }
+
+    IMetaData IModelMetaData.MetaData {
+      get { return this.MetaData; }
+    }
+
+  }
+}
Index: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs	(revision 2344)
+++ trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs	(revision 2355)
@@ -56,8 +56,9 @@
       DataLoadOptions dlo = new DataLoadOptions();
       dlo.LoadWith<ModelResult>(mr => mr.Result);
+      dlo.LoadWith<ModelMetaData>(mmd => mmd.MetaData);
       dlo.LoadWith<InputVariableResult>(ir => ir.Variable);
       dlo.LoadWith<InputVariableResult>(ir => ir.Result);
       dlo.LoadWith<Model>(m => m.TargetVariable);
-      dlo.LoadWith<Model>(m => m.Algorithm);
+      dlo.LoadWith<Model>(m => m.Algorithm);      
       ctx.LoadOptions = dlo;
     }
@@ -117,11 +118,11 @@
 
       // code to store meta-information for models (gkronber (8.9.09))
-      //using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
-      //  foreach (KeyValuePair<string, double> pair in model.MetaData) {
-      //    MetaData metaData = GetOrCreateMetaData(pair.Key);
-      //    ctx.ModelMetaData.InsertOnSubmit(new ModelMetaData(m, metaData, pair.Value));
-      //  }
-      //  ctx.SubmitChanges();
-      //}
+      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
+        foreach (KeyValuePair<string, double> pair in model.MetaData) {
+          MetaData metaData = GetOrCreateMetaData(pair.Key);
+          ctx.ModelMetaData.InsertOnSubmit(new ModelMetaData(m, metaData, pair.Value));
+        }
+        ctx.SubmitChanges();
+      }
 
       using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
@@ -267,4 +268,38 @@
     #endregion
 
+    #region ModelMetaData
+    public IEnumerable<IModelMetaData> GetModelMetaData(IModel model) {
+      var metadata = from md in ctx.ModelMetaData
+                     where md.Model == model
+                     select md;
+      return metadata.ToList().Cast<IModelMetaData>();
+    }
+    #endregion
+
+    #region MetaData
+    public IEnumerable<IMetaData> GetAllMetaData() {
+      return ctx.MetaData.ToList().Cast<IMetaData>();
+    }
+
+    public MetaData GetOrCreateMetaData(string name) {
+      MetaData metadata;
+      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
+        var md = from r in ctx.MetaData
+                      where r.Name == name
+                      select r;
+        if (md.Count() == 0) {
+          metadata = new MetaData(name);
+          ctx.MetaData.InsertOnSubmit(metadata);
+          ctx.SubmitChanges();
+        } else if (md.Count() == 1)
+          metadata = md.Single();
+        else
+          throw new ArgumentException("Could not get metadata. More than one metadata with the name " + name + " are saved in database.");
+      }
+      return metadata;
+    }
+
+    #endregion
+
     #region Model
     public IEnumerable<IModel> GetAllModels() {
Index: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/HeuristicLab.Modeling.Database.SQLServerCompact-3.2.csproj
===================================================================
--- trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/HeuristicLab.Modeling.Database.SQLServerCompact-3.2.csproj	(revision 2344)
+++ trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/HeuristicLab.Modeling.Database.SQLServerCompact-3.2.csproj	(revision 2355)
@@ -121,6 +121,8 @@
     <Compile Include="DataObjects\InputVariable.cs" />
     <Compile Include="DataObjects\InputVariableResult.cs" />
+    <Compile Include="DataObjects\MetaData.cs" />
     <Compile Include="DataObjects\Model.cs" />
     <Compile Include="DataObjects\ModelData.cs" />
+    <Compile Include="DataObjects\ModelMetaData.cs" />
     <Compile Include="HeuristicLabModelingDatabaseSQLServerCompactPlugin.cs" />
     <Compile Include="ModelingDataContext.cs" />
Index: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/ModelingDataContext.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/ModelingDataContext.cs	(revision 2344)
+++ trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/ModelingDataContext.cs	(revision 2355)
@@ -66,4 +66,12 @@
     }
 
+    public Table<ModelMetaData> ModelMetaData {
+      get { return GetTable<ModelMetaData>(); }
+    }
+
+    public Table<MetaData> MetaData {
+      get { return GetTable<MetaData>(); }
+    }
+
     public Table<InputVariable> InputVariables {
       get { return GetTable<InputVariable>(); }
