Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/AdministrationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/AdministrationService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/AdministrationService.cs	(revision 5479)
@@ -0,0 +1,352 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Data.Linq;
+using System.Linq;
+using System.Security.Cryptography;
+using System.ServiceModel;
+using HeuristicLab.Services.OKB.DataAccess;
+
+namespace HeuristicLab.Services.OKB.Administration {
+  /// <summary>
+  /// Implementation of the OKB administration service (interface <see cref="IAdministrationService"/>).
+  /// </summary>
+  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
+  public class AdministrationService : IAdministrationService {
+    #region Platform Methods
+    public DataTransfer.Platform GetPlatform(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.Platforms.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.Platform> GetPlatforms() {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.Platforms.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddPlatform(DataTransfer.Platform dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Platform entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.Platforms.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void UpdatePlatform(DataTransfer.Platform dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Platform entity = okb.Platforms.FirstOrDefault(x => x.Id == dto.Id);
+        Convert.ToEntity(dto, entity);
+        okb.SubmitChanges();
+      }
+    }
+    public void DeletePlatform(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Platform entity = okb.Platforms.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.Platforms.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    #endregion
+
+    #region DataType Methods
+    public DataTransfer.DataType GetDataType(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.DataTypes.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public long AddDataType(DataTransfer.DataType dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        var entity = okb.DataTypes.Where(x => (x.PlatformId == dto.PlatformId) && (x.Name == dto.Name) && (x.TypeName == dto.TypeName)).FirstOrDefault();
+        if (entity == null) {
+          entity = Convert.ToEntity(dto); entity.Id = 0;
+          okb.DataTypes.InsertOnSubmit(entity);
+          okb.SubmitChanges();
+        }
+        return entity.Id;
+      }
+    }
+    #endregion
+
+    #region BinaryData Methods
+    public long GetBinaryDataId(byte[] hash) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        var id = okb.BinaryDatas.Where(x => x.Hash.Equals(hash)).Select(x => x.Id).FirstOrDefault();
+        if (id == 0) return -1;
+        else return id;
+      }
+    }
+    public long AddBinaryData(DataTransfer.BinaryData dto) {
+      byte[] hash;
+      using (SHA1 sha1 = SHA1.Create()) {
+        hash = sha1.ComputeHash(dto.Data);
+      }
+
+      using (OKBDataContext okb = new OKBDataContext()) {
+        var id = okb.BinaryDatas.Where(x => x.Hash.Equals(hash)).Select(x => x.Id).FirstOrDefault();
+        if (id != 0) {
+          return id;
+        } else {
+          DataAccess.BinaryData entity = Convert.ToEntity(dto); entity.Id = 0;
+          okb.BinaryDatas.InsertOnSubmit(entity);
+          okb.SubmitChanges();
+          return entity.Id;
+        }
+      }
+    }
+    #endregion
+
+    #region AlgorithmClass Methods
+    public DataTransfer.AlgorithmClass GetAlgorithmClass(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.AlgorithmClasses.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.AlgorithmClass> GetAlgorithmClasses() {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.AlgorithmClasses.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddAlgorithmClass(DataTransfer.AlgorithmClass dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.AlgorithmClass entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.AlgorithmClasses.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void UpdateAlgorithmClass(DataTransfer.AlgorithmClass dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.AlgorithmClass entity = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == dto.Id);
+        Convert.ToEntity(dto, entity);
+        okb.SubmitChanges();
+      }
+    }
+    public void DeleteAlgorithmClass(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.AlgorithmClass entity = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.AlgorithmClasses.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    #endregion
+
+    #region Algorithm Methods
+    public DataTransfer.Algorithm GetAlgorithm(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.Algorithms.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.Algorithm> GetAlgorithms() {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.Algorithms.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddAlgorithm(DataTransfer.Algorithm dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Algorithm entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.Algorithms.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void UpdateAlgorithm(DataTransfer.Algorithm dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Algorithm entity = okb.Algorithms.FirstOrDefault(x => x.Id == dto.Id);
+        Convert.ToEntity(dto, entity);
+        okb.SubmitChanges();
+      }
+    }
+    public void DeleteAlgorithm(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Algorithm entity = okb.Algorithms.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.Algorithms.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    public IEnumerable<Guid> GetAlgorithmUsers(long algorithmId) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.AlgorithmUsers.Where(x => x.AlgorithmId == algorithmId).Select(x => x.UserId).ToArray();
+      }
+    }
+    public void UpdateAlgorithmUsers(long algorithmId, IEnumerable<Guid> users) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        okb.AlgorithmUsers.DeleteAllOnSubmit(okb.AlgorithmUsers.Where(x => x.AlgorithmId == algorithmId));
+        okb.AlgorithmUsers.InsertAllOnSubmit(users.Select(x => new DataAccess.AlgorithmUser { AlgorithmId = algorithmId, UserId = x }));
+        okb.SubmitChanges();
+      }
+    }
+    public DataTransfer.BinaryData GetAlgorithmData(long algorithmId) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataLoadOptions dlo = new DataLoadOptions();
+        dlo.LoadWith<Algorithm>(x => x.BinaryData);
+        okb.LoadOptions = dlo;
+        return Convert.ToDto(okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData).FirstOrDefault());
+      }
+    }
+    #endregion
+
+    #region ProblemClass Methods
+    public DataTransfer.ProblemClass GetProblemClass(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.ProblemClasses.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.ProblemClass> GetProblemClasses() {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.ProblemClasses.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddProblemClass(DataTransfer.ProblemClass dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.ProblemClass entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.ProblemClasses.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void UpdateProblemClass(DataTransfer.ProblemClass dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.ProblemClass entity = okb.ProblemClasses.FirstOrDefault(x => x.Id == dto.Id);
+        Convert.ToEntity(dto, entity);
+        okb.SubmitChanges();
+      }
+    }
+    public void DeleteProblemClass(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.ProblemClass entity = okb.ProblemClasses.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.ProblemClasses.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    #endregion
+
+    #region Problem Methods
+    public DataTransfer.Problem GetProblem(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return Convert.ToDto(okb.Problems.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.Problem> GetProblems() {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.Problems.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddProblem(DataTransfer.Problem dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Problem entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.Problems.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void UpdateProblem(DataTransfer.Problem dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Problem entity = okb.Problems.FirstOrDefault(x => x.Id == dto.Id);
+        Convert.ToEntity(dto, entity);
+        okb.SubmitChanges();
+      }
+    }
+    public void DeleteProblem(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Problem entity = okb.Problems.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.Problems.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    public IEnumerable<Guid> GetProblemUsers(long problemId) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return okb.ProblemUsers.Where(x => x.ProblemId == problemId).Select(x => x.UserId).ToArray();
+      }
+    }
+    public void UpdateProblemUsers(long problemId, IEnumerable<Guid> users) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        okb.ProblemUsers.DeleteAllOnSubmit(okb.ProblemUsers.Where(x => x.ProblemId == problemId));
+        okb.ProblemUsers.InsertAllOnSubmit(users.Select(x => new DataAccess.ProblemUser { ProblemId = problemId, UserId = x }));
+        okb.SubmitChanges();
+      }
+    }
+    public DataTransfer.BinaryData GetProblemData(long problemId) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataLoadOptions dlo = new DataLoadOptions();
+        dlo.LoadWith<Problem>(x => x.BinaryData);
+        okb.LoadOptions = dlo;
+        return Convert.ToDto(okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData).FirstOrDefault());
+      }
+    }
+    #endregion
+
+    #region Run Methods
+    public DataTransfer.Run GetRun(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataLoadOptions dlo = new DataLoadOptions();
+        dlo.LoadWith<Run>(x => x.Values);
+        dlo.LoadWith<Value>(x => x.ValueName);
+        okb.LoadOptions = dlo;
+        return Convert.ToDto(okb.Runs.FirstOrDefault(x => x.Id == id));
+      }
+    }
+    public IEnumerable<DataTransfer.Run> GetRuns(long algorithmId, long problemId) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataLoadOptions dlo = new DataLoadOptions();
+        dlo.LoadWith<Run>(x => x.Values);
+        dlo.LoadWith<Value>(x => x.ValueName);
+        okb.LoadOptions = dlo;
+        if ((algorithmId != 0) && (problemId != 0))
+          return okb.Runs.Where(x => (x.AlgorithmId == algorithmId) && (x.ProblemId == problemId)).Select(x => Convert.ToDto(x)).ToArray();
+        else if (algorithmId != 0)
+          return okb.Runs.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray();
+        else if (problemId != 0)
+          return okb.Runs.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray();
+        else
+          return okb.Runs.Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+    public long AddRun(DataTransfer.Run dto) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataAccess.Run entity = Convert.ToEntity(dto); entity.Id = 0;
+        okb.Runs.InsertOnSubmit(entity);
+        okb.SubmitChanges();
+        return entity.Id;
+      }
+    }
+    public void DeleteRun(long id) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        IEnumerable<DataAccess.ResultBlobValue> resultBlobValues = okb.ResultBlobValues.Where(x => x.RunId == id);
+        okb.ResultBlobValues.DeleteAllOnSubmit(resultBlobValues);
+        IEnumerable<DataAccess.ResultBoolValue> resultBoolValues = okb.ResultBoolValues.Where(x => x.RunId == id);
+        okb.ResultBoolValues.DeleteAllOnSubmit(resultBoolValues);
+        IEnumerable<DataAccess.ResultFloatValue> resultFloatValues = okb.ResultFloatValues.Where(x => x.RunId == id);
+        okb.ResultFloatValues.DeleteAllOnSubmit(resultFloatValues);
+        IEnumerable<DataAccess.ResultIntValue> resultIntValues = okb.ResultIntValues.Where(x => x.RunId == id);
+        okb.ResultIntValues.DeleteAllOnSubmit(resultIntValues);
+        IEnumerable<DataAccess.ResultStringValue> resultStringValues = okb.ResultStringValues.Where(x => x.RunId == id);
+        okb.ResultStringValues.DeleteAllOnSubmit(resultStringValues);
+
+        DataAccess.Run entity = okb.Runs.FirstOrDefault(x => x.Id == id);
+        if (entity != null) okb.Runs.DeleteOnSubmit(entity);
+        okb.SubmitChanges();
+      }
+    }
+    #endregion
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/IAdministrationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/IAdministrationService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Administration/IAdministrationService.cs	(revision 5479)
@@ -0,0 +1,136 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Net.Security;
+using System.ServiceModel;
+using HeuristicLab.Services.OKB.DataTransfer;
+
+namespace HeuristicLab.Services.OKB.Administration {
+  /// <summary>
+  /// Interface of the OKB administration service.
+  /// </summary>
+  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
+  public interface IAdministrationService {
+    #region Platform Methods
+    [OperationContract]
+    Platform GetPlatform(long id);
+    [OperationContract]
+    IEnumerable<Platform> GetPlatforms();
+    [OperationContract]
+    long AddPlatform(Platform dto);
+    [OperationContract]
+    void UpdatePlatform(Platform dto);
+    [OperationContract]
+    void DeletePlatform(long id);
+    #endregion
+
+    #region DataType Methods
+    [OperationContract]
+    DataType GetDataType(long id);
+    [OperationContract]
+    long AddDataType(DataType dto);
+    #endregion
+
+    #region BinaryData Methods
+    [OperationContract]
+    long GetBinaryDataId(byte[] hash);
+    [OperationContract]
+    long AddBinaryData(BinaryData dto);
+    #endregion
+
+    #region AlgorithmClass Methods
+    [OperationContract]
+    AlgorithmClass GetAlgorithmClass(long id);
+    [OperationContract]
+    IEnumerable<AlgorithmClass> GetAlgorithmClasses();
+    [OperationContract]
+    long AddAlgorithmClass(AlgorithmClass dto);
+    [OperationContract]
+    void UpdateAlgorithmClass(AlgorithmClass dto);
+    [OperationContract]
+    void DeleteAlgorithmClass(long id);
+    #endregion
+
+    #region Algorithm Methods
+    [OperationContract]
+    Algorithm GetAlgorithm(long id);
+    [OperationContract]
+    IEnumerable<Algorithm> GetAlgorithms();
+    [OperationContract]
+    long AddAlgorithm(Algorithm dto);
+    [OperationContract]
+    void UpdateAlgorithm(Algorithm dto);
+    [OperationContract]
+    void DeleteAlgorithm(long id);
+    [OperationContract]
+    IEnumerable<Guid> GetAlgorithmUsers(long algorithmId);
+    [OperationContract]
+    void UpdateAlgorithmUsers(long algorithmId, IEnumerable<Guid> users);
+    [OperationContract]
+    BinaryData GetAlgorithmData(long algorithmId);
+    #endregion
+
+    #region ProblemClass Methods
+    [OperationContract]
+    ProblemClass GetProblemClass(long id);
+    [OperationContract]
+    IEnumerable<ProblemClass> GetProblemClasses();
+    [OperationContract]
+    long AddProblemClass(ProblemClass dto);
+    [OperationContract]
+    void UpdateProblemClass(ProblemClass dto);
+    [OperationContract]
+    void DeleteProblemClass(long id);
+    #endregion
+
+    #region Problem Methods
+    [OperationContract]
+    Problem GetProblem(long id);
+    [OperationContract]
+    IEnumerable<Problem> GetProblems();
+    [OperationContract]
+    long AddProblem(Problem dto);
+    [OperationContract]
+    void UpdateProblem(Problem dto);
+    [OperationContract]
+    void DeleteProblem(long id);
+    [OperationContract]
+    IEnumerable<Guid> GetProblemUsers(long problemId);
+    [OperationContract]
+    void UpdateProblemUsers(long problemId, IEnumerable<Guid> users);
+    [OperationContract]
+    BinaryData GetProblemData(long problemId);
+    #endregion
+
+    #region Run Methods
+    [OperationContract]
+    Run GetRun(long id);
+    [OperationContract]
+    IEnumerable<Run> GetRuns(long algorithmId, long problemId);
+    [OperationContract]
+    long AddRun(Run dto);
+    [OperationContract]
+    void DeleteRun(long id);
+    #endregion
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AdministrationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AdministrationService.cs	(revision 5478)
+++ 	(revision )
@@ -1,352 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Data.Linq;
-using System.Linq;
-using System.Security.Cryptography;
-using System.ServiceModel;
-using HeuristicLab.Services.OKB.DataAccess;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Implementation of the OKB administration service (interface <see cref="IAdministrationService"/>).
-  /// </summary>
-  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
-  public class AdministrationService : IAdministrationService {
-    #region Platform Methods
-    public DataTransfer.Platform GetPlatform(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.Platforms.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.Platform> GetPlatforms() {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.Platforms.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddPlatform(DataTransfer.Platform dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Platform entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.Platforms.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void UpdatePlatform(DataTransfer.Platform dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Platform entity = okb.Platforms.FirstOrDefault(x => x.Id == dto.Id);
-        Convert.ToEntity(dto, entity);
-        okb.SubmitChanges();
-      }
-    }
-    public void DeletePlatform(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Platform entity = okb.Platforms.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.Platforms.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    #endregion
-
-    #region DataType Methods
-    public DataTransfer.DataType GetDataType(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.DataTypes.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public long AddDataType(DataTransfer.DataType dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        var entity = okb.DataTypes.Where(x => (x.PlatformId == dto.PlatformId) && (x.Name == dto.Name) && (x.TypeName == dto.TypeName)).FirstOrDefault();
-        if (entity == null) {
-          entity = Convert.ToEntity(dto); entity.Id = 0;
-          okb.DataTypes.InsertOnSubmit(entity);
-          okb.SubmitChanges();
-        }
-        return entity.Id;
-      }
-    }
-    #endregion
-
-    #region BinaryData Methods
-    public long GetBinaryDataId(byte[] hash) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        var id = okb.BinaryDatas.Where(x => x.Hash.Equals(hash)).Select(x => x.Id).FirstOrDefault();
-        if (id == 0) return -1;
-        else return id;
-      }
-    }
-    public long AddBinaryData(DataTransfer.BinaryData dto) {
-      byte[] hash;
-      using (SHA1 sha1 = SHA1.Create()) {
-        hash = sha1.ComputeHash(dto.Data);
-      }
-
-      using (OKBDataContext okb = new OKBDataContext()) {
-        var id = okb.BinaryDatas.Where(x => x.Hash.Equals(hash)).Select(x => x.Id).FirstOrDefault();
-        if (id != 0) {
-          return id;
-        } else {
-          DataAccess.BinaryData entity = Convert.ToEntity(dto); entity.Id = 0;
-          okb.BinaryDatas.InsertOnSubmit(entity);
-          okb.SubmitChanges();
-          return entity.Id;
-        }
-      }
-    }
-    #endregion
-
-    #region AlgorithmClass Methods
-    public DataTransfer.AlgorithmClass GetAlgorithmClass(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.AlgorithmClasses.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.AlgorithmClass> GetAlgorithmClasses() {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.AlgorithmClasses.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddAlgorithmClass(DataTransfer.AlgorithmClass dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.AlgorithmClass entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.AlgorithmClasses.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void UpdateAlgorithmClass(DataTransfer.AlgorithmClass dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.AlgorithmClass entity = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == dto.Id);
-        Convert.ToEntity(dto, entity);
-        okb.SubmitChanges();
-      }
-    }
-    public void DeleteAlgorithmClass(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.AlgorithmClass entity = okb.AlgorithmClasses.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.AlgorithmClasses.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    #endregion
-
-    #region Algorithm Methods
-    public DataTransfer.Algorithm GetAlgorithm(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.Algorithms.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.Algorithm> GetAlgorithms() {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.Algorithms.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddAlgorithm(DataTransfer.Algorithm dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Algorithm entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.Algorithms.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void UpdateAlgorithm(DataTransfer.Algorithm dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Algorithm entity = okb.Algorithms.FirstOrDefault(x => x.Id == dto.Id);
-        Convert.ToEntity(dto, entity);
-        okb.SubmitChanges();
-      }
-    }
-    public void DeleteAlgorithm(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Algorithm entity = okb.Algorithms.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.Algorithms.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    public IEnumerable<Guid> GetAlgorithmUsers(long algorithmId) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.AlgorithmUsers.Where(x => x.AlgorithmId == algorithmId).Select(x => x.UserId).ToArray();
-      }
-    }
-    public void UpdateAlgorithmUsers(long algorithmId, IEnumerable<Guid> users) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        okb.AlgorithmUsers.DeleteAllOnSubmit(okb.AlgorithmUsers.Where(x => x.AlgorithmId == algorithmId));
-        okb.AlgorithmUsers.InsertAllOnSubmit(users.Select(x => new DataAccess.AlgorithmUser { AlgorithmId = algorithmId, UserId = x }));
-        okb.SubmitChanges();
-      }
-    }
-    public DataTransfer.BinaryData GetAlgorithmData(long algorithmId) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<Algorithm>(x => x.BinaryData);
-        okb.LoadOptions = dlo;
-        return Convert.ToDto(okb.Algorithms.Where(x => x.Id == algorithmId).Select(x => x.BinaryData).FirstOrDefault());
-      }
-    }
-    #endregion
-
-    #region ProblemClass Methods
-    public DataTransfer.ProblemClass GetProblemClass(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.ProblemClasses.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.ProblemClass> GetProblemClasses() {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.ProblemClasses.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddProblemClass(DataTransfer.ProblemClass dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.ProblemClass entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.ProblemClasses.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void UpdateProblemClass(DataTransfer.ProblemClass dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.ProblemClass entity = okb.ProblemClasses.FirstOrDefault(x => x.Id == dto.Id);
-        Convert.ToEntity(dto, entity);
-        okb.SubmitChanges();
-      }
-    }
-    public void DeleteProblemClass(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.ProblemClass entity = okb.ProblemClasses.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.ProblemClasses.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    #endregion
-
-    #region Problem Methods
-    public DataTransfer.Problem GetProblem(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return Convert.ToDto(okb.Problems.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.Problem> GetProblems() {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.Problems.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddProblem(DataTransfer.Problem dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Problem entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.Problems.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void UpdateProblem(DataTransfer.Problem dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Problem entity = okb.Problems.FirstOrDefault(x => x.Id == dto.Id);
-        Convert.ToEntity(dto, entity);
-        okb.SubmitChanges();
-      }
-    }
-    public void DeleteProblem(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Problem entity = okb.Problems.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.Problems.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    public IEnumerable<Guid> GetProblemUsers(long problemId) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return okb.ProblemUsers.Where(x => x.ProblemId == problemId).Select(x => x.UserId).ToArray();
-      }
-    }
-    public void UpdateProblemUsers(long problemId, IEnumerable<Guid> users) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        okb.ProblemUsers.DeleteAllOnSubmit(okb.ProblemUsers.Where(x => x.ProblemId == problemId));
-        okb.ProblemUsers.InsertAllOnSubmit(users.Select(x => new DataAccess.ProblemUser { ProblemId = problemId, UserId = x }));
-        okb.SubmitChanges();
-      }
-    }
-    public DataTransfer.BinaryData GetProblemData(long problemId) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<Problem>(x => x.BinaryData);
-        okb.LoadOptions = dlo;
-        return Convert.ToDto(okb.Problems.Where(x => x.Id == problemId).Select(x => x.BinaryData).FirstOrDefault());
-      }
-    }
-    #endregion
-
-    #region Run Methods
-    public DataTransfer.Run GetRun(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<Run>(x => x.Values);
-        dlo.LoadWith<Value>(x => x.ValueName);
-        okb.LoadOptions = dlo;
-        return Convert.ToDto(okb.Runs.FirstOrDefault(x => x.Id == id));
-      }
-    }
-    public IEnumerable<DataTransfer.Run> GetRuns(long algorithmId, long problemId) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<Run>(x => x.Values);
-        dlo.LoadWith<Value>(x => x.ValueName);
-        okb.LoadOptions = dlo;
-        if ((algorithmId != 0) && (problemId != 0))
-          return okb.Runs.Where(x => (x.AlgorithmId == algorithmId) && (x.ProblemId == problemId)).Select(x => Convert.ToDto(x)).ToArray();
-        else if (algorithmId != 0)
-          return okb.Runs.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray();
-        else if (problemId != 0)
-          return okb.Runs.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray();
-        else
-          return okb.Runs.Select(x => Convert.ToDto(x)).ToArray();
-      }
-    }
-    public long AddRun(DataTransfer.Run dto) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataAccess.Run entity = Convert.ToEntity(dto); entity.Id = 0;
-        okb.Runs.InsertOnSubmit(entity);
-        okb.SubmitChanges();
-        return entity.Id;
-      }
-    }
-    public void DeleteRun(long id) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        IEnumerable<DataAccess.ResultBlobValue> resultBlobValues = okb.ResultBlobValues.Where(x => x.RunId == id);
-        okb.ResultBlobValues.DeleteAllOnSubmit(resultBlobValues);
-        IEnumerable<DataAccess.ResultBoolValue> resultBoolValues = okb.ResultBoolValues.Where(x => x.RunId == id);
-        okb.ResultBoolValues.DeleteAllOnSubmit(resultBoolValues);
-        IEnumerable<DataAccess.ResultFloatValue> resultFloatValues = okb.ResultFloatValues.Where(x => x.RunId == id);
-        okb.ResultFloatValues.DeleteAllOnSubmit(resultFloatValues);
-        IEnumerable<DataAccess.ResultIntValue> resultIntValues = okb.ResultIntValues.Where(x => x.RunId == id);
-        okb.ResultIntValues.DeleteAllOnSubmit(resultIntValues);
-        IEnumerable<DataAccess.ResultStringValue> resultStringValues = okb.ResultStringValues.Where(x => x.RunId == id);
-        okb.ResultStringValues.DeleteAllOnSubmit(resultStringValues);
-
-        DataAccess.Run entity = okb.Runs.FirstOrDefault(x => x.Id == id);
-        if (entity != null) okb.Runs.DeleteOnSubmit(entity);
-        okb.SubmitChanges();
-      }
-    }
-    #endregion
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/AuthenticationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/AuthenticationService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/AuthenticationService.cs	(revision 5479)
@@ -0,0 +1,45 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.ServiceModel;
+using System.Web.Security;
+
+namespace HeuristicLab.Services.OKB.Authentication {
+  /// <summary>
+  /// Implementation of the OKB authentication service (interface <see cref="IAuthenticationService"/>).
+  /// </summary>
+  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
+  public class AuthenticationService : IAuthenticationService {
+    public DataTransfer.User GetUser(Guid id) {
+      MembershipUser user = Membership.GetUser(id);
+      if (user != null) return new DataTransfer.User { Id = id, Name = user.UserName };
+      else return null;
+    }
+    public IEnumerable<DataTransfer.User> GetUsers() {
+      List<DataTransfer.User> users = new List<DataTransfer.User>();
+      foreach (MembershipUser user in Membership.GetAllUsers())
+        users.Add(new DataTransfer.User { Id = (Guid)user.ProviderUserKey, Name = user.UserName });
+      return users;
+    }
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/DataTransfer/User.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/DataTransfer/User.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/DataTransfer/User.cs	(revision 5479)
@@ -0,0 +1,33 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Runtime.Serialization;
+
+namespace HeuristicLab.Services.OKB.Authentication.DataTransfer {
+  [DataContract]
+  public class User {
+    [DataMember]
+    public Guid Id { get; set; }
+    [DataMember]
+    public string Name { get; set; }
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/IAuthenticationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/IAuthenticationService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Authentication/IAuthenticationService.cs	(revision 5479)
@@ -0,0 +1,39 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Net.Security;
+using System.ServiceModel;
+using HeuristicLab.Services.OKB.Authentication.DataTransfer;
+
+namespace HeuristicLab.Services.OKB.Authentication {
+  /// <summary>
+  /// Interface of the OKB authentication service.
+  /// </summary>
+  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
+  public interface IAuthenticationService {
+    [OperationContract]
+    User GetUser(Guid id);
+    [OperationContract]
+    IEnumerable<User> GetUsers();
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AuthenticationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AuthenticationService.cs	(revision 5478)
+++ 	(revision )
@@ -1,45 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.ServiceModel;
-using System.Web.Security;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Implementation of the OKB authentication service (interface <see cref="IAuthenticationService"/>).
-  /// </summary>
-  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
-  public class AuthenticationService : IAuthenticationService {
-    public DataTransfer.User GetUser(Guid id) {
-      MembershipUser user = Membership.GetUser(id);
-      if (user != null) return new DataTransfer.User { Id = id, Name = user.UserName };
-      else return null;
-    }
-    public IEnumerable<DataTransfer.User> GetUsers() {
-      List<DataTransfer.User> users = new List<DataTransfer.User>();
-      foreach (MembershipUser user in Membership.GetAllUsers())
-        users.Add(new DataTransfer.User { Id = (Guid)user.ProviderUserKey, Name = user.UserName });
-      return users;
-    }
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj	(revision 5478)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj	(revision 5479)
@@ -120,9 +120,10 @@
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AdministrationService.cs" />
+    <Compile Include="Administration\AdministrationService.cs" />
+    <Compile Include="Administration\IAdministrationService.cs" />
+    <Compile Include="Authentication\AuthenticationService.cs" />
+    <Compile Include="Authentication\DataTransfer\User.cs" />
+    <Compile Include="Authentication\IAuthenticationService.cs" />
     <Compile Include="Convert.cs" />
-    <Compile Include="AuthenticationService.cs" />
-    <Compile Include="Interfaces\IAdministrationService.cs" />
-    <Compile Include="QueryService.cs" />
     <Compile Include="Filters\AlgorithmParameterBlobValueDataTypeNameFilter.cs" />
     <Compile Include="Filters\AlgorithmParameterBlobValueValueFilter.cs" />
@@ -160,8 +161,8 @@
     <Compile Include="Filters\ResultStringValueValueFilter.cs" />
     <Compile Include="Filters\ResultFloatValueValueFilter.cs" />
-    <Compile Include="Interfaces\IQueryService.cs" />
-    <Compile Include="Interfaces\IAuthenticationService.cs" />
-    <Compile Include="Interfaces\IFilter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Query\IFilter.cs" />
+    <Compile Include="Query\IQueryService.cs" />
+    <Compile Include="Query\QueryService.cs" />
     <Compile Include="RunCreation\Convert.cs" />
     <Compile Include="RunCreation\DataTransfer\Algorithm.cs" />
@@ -200,7 +201,7 @@
   </ItemGroup>
   <ItemGroup>
-    <Folder Include="Administration\" />
-    <Folder Include="Authentication\" />
-    <Folder Include="Query\" />
+    <Folder Include="Administration\DataTransfer\" />
+    <Folder Include="Interfaces\" />
+    <Folder Include="Query\DataTransfer\" />
   </ItemGroup>
   <ItemGroup>
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAdministrationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAdministrationService.cs	(revision 5478)
+++ 	(revision )
@@ -1,136 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Net.Security;
-using System.ServiceModel;
-using HeuristicLab.Services.OKB.DataTransfer;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Interface of the OKB administration service.
-  /// </summary>
-  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
-  public interface IAdministrationService {
-    #region Platform Methods
-    [OperationContract]
-    Platform GetPlatform(long id);
-    [OperationContract]
-    IEnumerable<Platform> GetPlatforms();
-    [OperationContract]
-    long AddPlatform(Platform dto);
-    [OperationContract]
-    void UpdatePlatform(Platform dto);
-    [OperationContract]
-    void DeletePlatform(long id);
-    #endregion
-
-    #region DataType Methods
-    [OperationContract]
-    DataType GetDataType(long id);
-    [OperationContract]
-    long AddDataType(DataType dto);
-    #endregion
-
-    #region BinaryData Methods
-    [OperationContract]
-    long GetBinaryDataId(byte[] hash);
-    [OperationContract]
-    long AddBinaryData(BinaryData dto);
-    #endregion
-
-    #region AlgorithmClass Methods
-    [OperationContract]
-    AlgorithmClass GetAlgorithmClass(long id);
-    [OperationContract]
-    IEnumerable<AlgorithmClass> GetAlgorithmClasses();
-    [OperationContract]
-    long AddAlgorithmClass(AlgorithmClass dto);
-    [OperationContract]
-    void UpdateAlgorithmClass(AlgorithmClass dto);
-    [OperationContract]
-    void DeleteAlgorithmClass(long id);
-    #endregion
-
-    #region Algorithm Methods
-    [OperationContract]
-    Algorithm GetAlgorithm(long id);
-    [OperationContract]
-    IEnumerable<Algorithm> GetAlgorithms();
-    [OperationContract]
-    long AddAlgorithm(Algorithm dto);
-    [OperationContract]
-    void UpdateAlgorithm(Algorithm dto);
-    [OperationContract]
-    void DeleteAlgorithm(long id);
-    [OperationContract]
-    IEnumerable<Guid> GetAlgorithmUsers(long algorithmId);
-    [OperationContract]
-    void UpdateAlgorithmUsers(long algorithmId, IEnumerable<Guid> users);
-    [OperationContract]
-    BinaryData GetAlgorithmData(long algorithmId);
-    #endregion
-
-    #region ProblemClass Methods
-    [OperationContract]
-    ProblemClass GetProblemClass(long id);
-    [OperationContract]
-    IEnumerable<ProblemClass> GetProblemClasses();
-    [OperationContract]
-    long AddProblemClass(ProblemClass dto);
-    [OperationContract]
-    void UpdateProblemClass(ProblemClass dto);
-    [OperationContract]
-    void DeleteProblemClass(long id);
-    #endregion
-
-    #region Problem Methods
-    [OperationContract]
-    Problem GetProblem(long id);
-    [OperationContract]
-    IEnumerable<Problem> GetProblems();
-    [OperationContract]
-    long AddProblem(Problem dto);
-    [OperationContract]
-    void UpdateProblem(Problem dto);
-    [OperationContract]
-    void DeleteProblem(long id);
-    [OperationContract]
-    IEnumerable<Guid> GetProblemUsers(long problemId);
-    [OperationContract]
-    void UpdateProblemUsers(long problemId, IEnumerable<Guid> users);
-    [OperationContract]
-    BinaryData GetProblemData(long problemId);
-    #endregion
-
-    #region Run Methods
-    [OperationContract]
-    Run GetRun(long id);
-    [OperationContract]
-    IEnumerable<Run> GetRuns(long algorithmId, long problemId);
-    [OperationContract]
-    long AddRun(Run dto);
-    [OperationContract]
-    void DeleteRun(long id);
-    #endregion
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAuthenticationService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAuthenticationService.cs	(revision 5478)
+++ 	(revision )
@@ -1,39 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Net.Security;
-using System.ServiceModel;
-using HeuristicLab.Services.OKB.DataTransfer;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Interface of the OKB authentication service.
-  /// </summary>
-  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
-  public interface IAuthenticationService {
-    [OperationContract]
-    User GetUser(Guid id);
-    [OperationContract]
-    IEnumerable<User> GetUsers();
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IFilter.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IFilter.cs	(revision 5478)
+++ 	(revision )
@@ -1,30 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Linq.Expressions;
-using HeuristicLab.Services.OKB.DataAccess;
-
-namespace HeuristicLab.Services.OKB {
-  public interface IFilter {
-    Expression<Func<Run, bool>> Expression { get; }
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IQueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IQueryService.cs	(revision 5478)
+++ 	(revision )
@@ -1,45 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Collections.Generic;
-using System.Net.Security;
-using System.ServiceModel;
-using HeuristicLab.Services.OKB.DataTransfer;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Interface of the OKB query service.
-  /// </summary>
-  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
-  public interface IQueryService {
-    [OperationContract]
-    IEnumerable<Filter> GetFilters();
-
-    [OperationContract]
-    long GetNumberOfQueryResults(Filter filter);
-
-    [OperationContract]
-    IEnumerable<long> GetQueryResultIds(Filter filter);
-
-    [OperationContract]
-    IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids);
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IFilter.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IFilter.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IFilter.cs	(revision 5479)
@@ -0,0 +1,30 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Linq.Expressions;
+using HeuristicLab.Services.OKB.DataAccess;
+
+namespace HeuristicLab.Services.OKB.Query {
+  public interface IFilter {
+    Expression<Func<Run, bool>> Expression { get; }
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs	(revision 5479)
@@ -0,0 +1,45 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Collections.Generic;
+using System.Net.Security;
+using System.ServiceModel;
+using HeuristicLab.Services.OKB.DataTransfer;
+
+namespace HeuristicLab.Services.OKB.Query {
+  /// <summary>
+  /// Interface of the OKB query service.
+  /// </summary>
+  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
+  public interface IQueryService {
+    [OperationContract]
+    IEnumerable<Filter> GetFilters();
+
+    [OperationContract]
+    long GetNumberOfQueryResults(Filter filter);
+
+    [OperationContract]
+    IEnumerable<long> GetQueryResultIds(Filter filter);
+
+    [OperationContract]
+    IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids);
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs	(revision 5479)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs	(revision 5479)
@@ -0,0 +1,223 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Data.Linq;
+using System.Linq;
+using System.ServiceModel;
+using HeuristicLab.Services.OKB.DataAccess;
+using HeuristicLab.Services.OKB.DataTransfer;
+
+namespace HeuristicLab.Services.OKB.Query {
+  /// <summary>
+  /// Implementation of the OKB query service (interface <see cref="IQueryService"/>).
+  /// </summary>
+  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
+  public class QueryService : IQueryService {
+    public IEnumerable<Filter> GetFilters() {
+      List<Filter> filters = new List<Filter>();
+      using (OKBDataContext okb = new OKBDataContext()) {
+        // run filters
+        filters.Add(new OrdinalComparisonLongFilter(typeof(RunRandomSeedFilter).AssemblyQualifiedName, "Run Random Seed"));
+        filters.Add(new OrdinalComparisonDateTimeFilter(typeof(RunCreatedDateFilter).AssemblyQualifiedName, "Run Created Date"));
+        filters.Add(new SetComparisonStringFilter(typeof(RunUserNameFilter).AssemblyQualifiedName, "Run User Name"));
+        filters.Add(new SetComparisonStringFilter(typeof(RunClientNameFilter).AssemblyQualifiedName, "Run Client Name"));
+
+        // result filters
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ResultNameFilter).AssemblyQualifiedName, "Result Name", okb.Results.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ResultBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Result " + name + " Value Data Type Name", name, okb.ResultBlobValues.Where(x => x.Result.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ResultBlobValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ResultBoolValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ResultFloatValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ResultIntValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(ResultStringValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+
+        // algorithm parameter filters
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterNameFilter).AssemblyQualifiedName, "Algorithm Parameter Name", okb.AlgorithmParameters.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value Data Type Name", name, okb.AlgorithmParameterBlobValues.Where(x => x.AlgorithmParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(AlgorithmParameterBlobValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(AlgorithmParameterBoolValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(AlgorithmParameterFloatValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(AlgorithmParameterIntValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(AlgorithmParameterStringValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+
+        // algorithm filters
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmNameFilter).AssemblyQualifiedName, "Algorithm Name", okb.Algorithms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmClassNameFilter).AssemblyQualifiedName, "Algorithm Class Name", okb.AlgorithmClasses.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmPlatformNameFilter).AssemblyQualifiedName, "Algorithm Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmDataDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Data Type Name", okb.Algorithms.Select(x => x.AlgorithmData.DataType.Name).Distinct().ToArray()));
+
+        // problem parameter filters
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemParameterNameFilter).AssemblyQualifiedName, "Problem Parameter Name", okb.ProblemParameters.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ProblemParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value Data Type Name", name, okb.ProblemParameterBlobValues.Where(x => x.ProblemParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ProblemParameterBlobValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ProblemParameterBoolValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ProblemParameterFloatValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ProblemParameterIntValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(ProblemParameterStringValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+
+        // problem filters
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemNameFilter).AssemblyQualifiedName, "Problem Name", okb.Problems.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemClassNameFilter).AssemblyQualifiedName, "Problem Class Name", okb.ProblemClasses.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemPlatformNameFilter).AssemblyQualifiedName, "Problem Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemDataDataTypeNameFilter).AssemblyQualifiedName, "Problem Data Type Name", okb.Problems.Select(x => x.ProblemData.DataType.Name).Distinct().ToArray()));
+
+        // and/or filters
+        filters.Add(new CombinedFilter(typeof(AndFilter).AssemblyQualifiedName, "AND", BooleanOperation.And));
+        filters.Add(new CombinedFilter(typeof(OrFilter).AssemblyQualifiedName, "OR", BooleanOperation.Or));
+      }
+      return filters.OrderBy(x => x.Label);
+    }
+
+    public long GetNumberOfQueryResults(Filter filter) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return FilterRuns(okb.Runs, filter).LongCount();
+      }
+    }
+
+    public IEnumerable<long> GetQueryResultIds(Filter filter) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return FilterRuns(okb.Runs, filter).Select(x => x.Id).ToArray();
+      }
+    }
+
+    public IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        DataLoadOptions dlo = new DataLoadOptions();
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultBlobValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultBoolValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultFloatValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultIntValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultStringValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.Experiment);
+        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.ResultBoolValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultFloatValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultIntValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultStringValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBlobValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBoolValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterFloatValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterIntValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterStringValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBlobValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBoolValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterFloatValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterIntValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterStringValues);
+        //dlo.LoadWith<DataAccess.Experiment>(x => x.Algorithm);
+        //dlo.LoadWith<DataAccess.Experiment>(x => x.Problem);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBoolValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterFloatValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterIntValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterStringValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.ProblemParameterBoolValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterFloatValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterIntValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterStringValue>(x => x.ProblemParameter);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmParameters);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Results);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmClass);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Platform);
+        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemParameters);
+        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemClass);
+        okb.LoadOptions = dlo;
+
+        return okb.Runs.Where(x => ids.Contains(x.Id)).Select(x => ConvertToQueryResult(x)).ToArray();
+      }
+    }
+
+    private IQueryable<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter) {
+      IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
+      return runs.Where(f.Expression);
+    }
+
+    private QueryResult ConvertToQueryResult(DataAccess.Run run) {
+      List<QueryValue> algorithmParameters = new List<QueryValue>();
+      List<QueryValue> problemParameters = new List<QueryValue>();
+      List<QueryValue> results = new List<QueryValue>();
+
+      foreach (DataAccess.AlgorithmParameterBlobValue value in run.Experiment.AlgorithmParameterBlobValues)
+        algorithmParameters.Add(new QueryBlobValue { Name = value.AlgorithmParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.AlgorithmParameterBoolValue value in run.Experiment.AlgorithmParameterBoolValues)
+        algorithmParameters.Add(new QueryBoolValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterFloatValue value in run.Experiment.AlgorithmParameterFloatValues)
+        algorithmParameters.Add(new QueryFloatValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterIntValue value in run.Experiment.AlgorithmParameterIntValues)
+        algorithmParameters.Add(new QueryIntValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterStringValue value in run.Experiment.AlgorithmParameterStringValues)
+        algorithmParameters.Add(new QueryStringValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+
+      foreach (DataAccess.ProblemParameterBlobValue value in run.Experiment.ProblemParameterBlobValues)
+        problemParameters.Add(new QueryBlobValue { Name = value.ProblemParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.ProblemParameterBoolValue value in run.Experiment.ProblemParameterBoolValues)
+        problemParameters.Add(new QueryBoolValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterFloatValue value in run.Experiment.ProblemParameterFloatValues)
+        problemParameters.Add(new QueryFloatValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterIntValue value in run.Experiment.ProblemParameterIntValues)
+        problemParameters.Add(new QueryIntValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterStringValue value in run.Experiment.ProblemParameterStringValues)
+        problemParameters.Add(new QueryStringValue { Name = value.ProblemParameter.Name, Value = value.Value });
+
+      foreach (DataAccess.ResultBlobValue value in run.ResultBlobValues)
+        results.Add(new QueryBlobValue { Name = value.Result.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.ResultBoolValue value in run.ResultBoolValues)
+        results.Add(new QueryBoolValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultFloatValue value in run.ResultFloatValues)
+        results.Add(new QueryFloatValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultIntValue value in run.ResultIntValues)
+        results.Add(new QueryIntValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultStringValue value in run.ResultStringValues)
+        results.Add(new QueryStringValue { Name = value.Result.Name, Value = value.Value });
+
+      QueryResult result = new QueryResult();
+      result.Id = run.Id;
+      result.AlgorithmParameters = algorithmParameters;
+      result.ProblemParameters = problemParameters;
+      result.Results = results;
+      return result;
+    }
+  }
+}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/QueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/QueryService.cs	(revision 5478)
+++ 	(revision )
@@ -1,223 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 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.Data.Linq;
-using System.Linq;
-using System.ServiceModel;
-using HeuristicLab.Services.OKB.DataAccess;
-using HeuristicLab.Services.OKB.DataTransfer;
-
-namespace HeuristicLab.Services.OKB {
-  /// <summary>
-  /// Implementation of the OKB query service (interface <see cref="IQueryService"/>).
-  /// </summary>
-  [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
-  public class QueryService : IQueryService {
-    public IEnumerable<Filter> GetFilters() {
-      List<Filter> filters = new List<Filter>();
-      using (OKBDataContext okb = new OKBDataContext()) {
-        // run filters
-        filters.Add(new OrdinalComparisonLongFilter(typeof(RunRandomSeedFilter).AssemblyQualifiedName, "Run Random Seed"));
-        filters.Add(new OrdinalComparisonDateTimeFilter(typeof(RunCreatedDateFilter).AssemblyQualifiedName, "Run Created Date"));
-        filters.Add(new SetComparisonStringFilter(typeof(RunUserNameFilter).AssemblyQualifiedName, "Run User Name"));
-        filters.Add(new SetComparisonStringFilter(typeof(RunClientNameFilter).AssemblyQualifiedName, "Run Client Name"));
-
-        // result filters
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ResultNameFilter).AssemblyQualifiedName, "Result Name", okb.Results.Select(x => x.Name).Distinct().ToArray()));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ResultBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Result " + name + " Value Data Type Name", name, okb.ResultBlobValues.Where(x => x.Result.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ResultBlobValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ResultBoolValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ResultFloatValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ResultIntValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
-        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringFilter(typeof(ResultStringValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
-
-        // algorithm parameter filters
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterNameFilter).AssemblyQualifiedName, "Algorithm Parameter Name", okb.AlgorithmParameters.Select(x => x.Name).Distinct().ToArray()));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value Data Type Name", name, okb.AlgorithmParameterBlobValues.Where(x => x.AlgorithmParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(AlgorithmParameterBlobValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonBoolFilter(typeof(AlgorithmParameterBoolValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(AlgorithmParameterFloatValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonLongFilter(typeof(AlgorithmParameterIntValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
-        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringFilter(typeof(AlgorithmParameterStringValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
-
-        // algorithm filters
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmNameFilter).AssemblyQualifiedName, "Algorithm Name", okb.Algorithms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmClassNameFilter).AssemblyQualifiedName, "Algorithm Class Name", okb.AlgorithmClasses.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmPlatformNameFilter).AssemblyQualifiedName, "Algorithm Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmDataDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Data Type Name", okb.Algorithms.Select(x => x.AlgorithmData.DataType.Name).Distinct().ToArray()));
-
-        // problem parameter filters
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemParameterNameFilter).AssemblyQualifiedName, "Problem Parameter Name", okb.ProblemParameters.Select(x => x.Name).Distinct().ToArray()));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ProblemParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value Data Type Name", name, okb.ProblemParameterBlobValues.Where(x => x.ProblemParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ProblemParameterBlobValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
-          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ProblemParameterBoolValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ProblemParameterFloatValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
-          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ProblemParameterIntValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
-        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
-          filters.Add(new NameSetComparisonStringFilter(typeof(ProblemParameterStringValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
-
-        // problem filters
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemNameFilter).AssemblyQualifiedName, "Problem Name", okb.Problems.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemClassNameFilter).AssemblyQualifiedName, "Problem Class Name", okb.ProblemClasses.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemPlatformNameFilter).AssemblyQualifiedName, "Problem Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemDataDataTypeNameFilter).AssemblyQualifiedName, "Problem Data Type Name", okb.Problems.Select(x => x.ProblemData.DataType.Name).Distinct().ToArray()));
-
-        // and/or filters
-        filters.Add(new CombinedFilter(typeof(AndFilter).AssemblyQualifiedName, "AND", BooleanOperation.And));
-        filters.Add(new CombinedFilter(typeof(OrFilter).AssemblyQualifiedName, "OR", BooleanOperation.Or));
-      }
-      return filters.OrderBy(x => x.Label);
-    }
-
-    public long GetNumberOfQueryResults(Filter filter) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return FilterRuns(okb.Runs, filter).LongCount();
-      }
-    }
-
-    public IEnumerable<long> GetQueryResultIds(Filter filter) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        return FilterRuns(okb.Runs, filter).Select(x => x.Id).ToArray();
-      }
-    }
-
-    public IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<DataAccess.Run>(x => x.ResultBlobValues);
-        dlo.LoadWith<DataAccess.Run>(x => x.ResultBoolValues);
-        dlo.LoadWith<DataAccess.Run>(x => x.ResultFloatValues);
-        dlo.LoadWith<DataAccess.Run>(x => x.ResultIntValues);
-        dlo.LoadWith<DataAccess.Run>(x => x.ResultStringValues);
-        dlo.LoadWith<DataAccess.Run>(x => x.Experiment);
-        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.Result);
-        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.DataType);
-        dlo.LoadWith<DataAccess.ResultBoolValue>(x => x.Result);
-        dlo.LoadWith<DataAccess.ResultFloatValue>(x => x.Result);
-        dlo.LoadWith<DataAccess.ResultIntValue>(x => x.Result);
-        dlo.LoadWith<DataAccess.ResultStringValue>(x => x.Result);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBlobValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBoolValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterFloatValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterIntValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterStringValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBlobValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBoolValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterFloatValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterIntValues);
-        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterStringValues);
-        //dlo.LoadWith<DataAccess.Experiment>(x => x.Algorithm);
-        //dlo.LoadWith<DataAccess.Experiment>(x => x.Problem);
-        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.AlgorithmParameter);
-        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.DataType);
-        dlo.LoadWith<DataAccess.AlgorithmParameterBoolValue>(x => x.AlgorithmParameter);
-        dlo.LoadWith<DataAccess.AlgorithmParameterFloatValue>(x => x.AlgorithmParameter);
-        dlo.LoadWith<DataAccess.AlgorithmParameterIntValue>(x => x.AlgorithmParameter);
-        dlo.LoadWith<DataAccess.AlgorithmParameterStringValue>(x => x.AlgorithmParameter);
-        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.ProblemParameter);
-        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.DataType);
-        dlo.LoadWith<DataAccess.ProblemParameterBoolValue>(x => x.ProblemParameter);
-        dlo.LoadWith<DataAccess.ProblemParameterFloatValue>(x => x.ProblemParameter);
-        dlo.LoadWith<DataAccess.ProblemParameterIntValue>(x => x.ProblemParameter);
-        dlo.LoadWith<DataAccess.ProblemParameterStringValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmParameters);
-        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Results);
-        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmClass);
-        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Platform);
-        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemParameters);
-        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemClass);
-        okb.LoadOptions = dlo;
-
-        return okb.Runs.Where(x => ids.Contains(x.Id)).Select(x => ConvertToQueryResult(x)).ToArray();
-      }
-    }
-
-    private IQueryable<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter) {
-      IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
-      return runs.Where(f.Expression);
-    }
-
-    private QueryResult ConvertToQueryResult(DataAccess.Run run) {
-      List<QueryValue> algorithmParameters = new List<QueryValue>();
-      List<QueryValue> problemParameters = new List<QueryValue>();
-      List<QueryValue> results = new List<QueryValue>();
-
-      foreach (DataAccess.AlgorithmParameterBlobValue value in run.Experiment.AlgorithmParameterBlobValues)
-        algorithmParameters.Add(new QueryBlobValue { Name = value.AlgorithmParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
-      foreach (DataAccess.AlgorithmParameterBoolValue value in run.Experiment.AlgorithmParameterBoolValues)
-        algorithmParameters.Add(new QueryBoolValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
-      foreach (DataAccess.AlgorithmParameterFloatValue value in run.Experiment.AlgorithmParameterFloatValues)
-        algorithmParameters.Add(new QueryFloatValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
-      foreach (DataAccess.AlgorithmParameterIntValue value in run.Experiment.AlgorithmParameterIntValues)
-        algorithmParameters.Add(new QueryIntValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
-      foreach (DataAccess.AlgorithmParameterStringValue value in run.Experiment.AlgorithmParameterStringValues)
-        algorithmParameters.Add(new QueryStringValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
-
-      foreach (DataAccess.ProblemParameterBlobValue value in run.Experiment.ProblemParameterBlobValues)
-        problemParameters.Add(new QueryBlobValue { Name = value.ProblemParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
-      foreach (DataAccess.ProblemParameterBoolValue value in run.Experiment.ProblemParameterBoolValues)
-        problemParameters.Add(new QueryBoolValue { Name = value.ProblemParameter.Name, Value = value.Value });
-      foreach (DataAccess.ProblemParameterFloatValue value in run.Experiment.ProblemParameterFloatValues)
-        problemParameters.Add(new QueryFloatValue { Name = value.ProblemParameter.Name, Value = value.Value });
-      foreach (DataAccess.ProblemParameterIntValue value in run.Experiment.ProblemParameterIntValues)
-        problemParameters.Add(new QueryIntValue { Name = value.ProblemParameter.Name, Value = value.Value });
-      foreach (DataAccess.ProblemParameterStringValue value in run.Experiment.ProblemParameterStringValues)
-        problemParameters.Add(new QueryStringValue { Name = value.ProblemParameter.Name, Value = value.Value });
-
-      foreach (DataAccess.ResultBlobValue value in run.ResultBlobValues)
-        results.Add(new QueryBlobValue { Name = value.Result.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
-      foreach (DataAccess.ResultBoolValue value in run.ResultBoolValues)
-        results.Add(new QueryBoolValue { Name = value.Result.Name, Value = value.Value });
-      foreach (DataAccess.ResultFloatValue value in run.ResultFloatValues)
-        results.Add(new QueryFloatValue { Name = value.Result.Name, Value = value.Value });
-      foreach (DataAccess.ResultIntValue value in run.ResultIntValues)
-        results.Add(new QueryIntValue { Name = value.Result.Name, Value = value.Value });
-      foreach (DataAccess.ResultStringValue value in run.ResultStringValues)
-        results.Add(new QueryStringValue { Name = value.Result.Name, Value = value.Value });
-
-      QueryResult result = new QueryResult();
-      result.Id = run.Id;
-      result.AlgorithmParameters = algorithmParameters;
-      result.ProblemParameters = problemParameters;
-      result.Results = results;
-      return result;
-    }
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/app.config
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/app.config	(revision 5478)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/app.config	(revision 5479)
@@ -59,9 +59,9 @@
 
     <services>
-      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.AuthenticationService">
+      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.Authentication.AuthenticationService">
         <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
           contract="IMetadataExchange" />
         <endpoint binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
-          contract="HeuristicLab.Services.OKB.IAuthenticationService" />
+          contract="HeuristicLab.Services.OKB.Authentication.IAuthenticationService" />
         <host>
           <baseAddresses>
@@ -70,9 +70,9 @@
         </host>
       </service>
-      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.AdministrationService">
+      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.Administration.AdministrationService">
         <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
           contract="IMetadataExchange" />
         <endpoint binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
-          contract="HeuristicLab.Services.OKB.IAdministrationService" />
+          contract="HeuristicLab.Services.OKB.Administration.IAdministrationService" />
         <host>
           <baseAddresses>
@@ -81,9 +81,20 @@
         </host>
       </service>
-      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.QueryService">
+      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.RunCreation.RunCreationService">
         <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
           contract="IMetadataExchange" />
         <endpoint binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
-          contract="HeuristicLab.Services.OKB.IQueryService" />
+          contract="HeuristicLab.Services.OKB.RunCreation.IRunCreationService" />
+        <host>
+          <baseAddresses>
+            <add baseAddress="http://localhost:8732/Design_Time_Addresses/OKB-3.3/RunCreationService" />
+          </baseAddresses>
+        </host>
+      </service>
+      <service behaviorConfiguration="DefaultServiceBehavior" name="HeuristicLab.Services.OKB.Query.QueryService">
+        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="DefaultMexHttpBinding"
+          contract="IMetadataExchange" />
+        <endpoint binding="wsHttpBinding" bindingConfiguration="DefaultWsHttpBinding"
+          contract="HeuristicLab.Services.OKB.Query.IQueryService" />
         <host>
           <baseAddresses>
