Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/Program.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/Program.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/ConsoleTests/Program.cs	(revision 6431)
@@ -22,4 +22,5 @@
       //TestThreadSafeLog(); return;
       //TestThreadSafePersistence(); return;
+      TestCappedLog(); return;
       string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
 
@@ -31,4 +32,31 @@
       var app = pm.Applications.Where(x => x.Name == "HeuristicLab.Clients.Hive.Slave.Tests").Single();
       pm.Run(app);
+    }
+
+    private static void TestCappedLog() {
+      ILog log = new Log(); // maxMessageCount = -1
+      Console.WriteLine("0=={0}", log.Messages.Count());
+      log.LogMessage("asdf");
+      Console.WriteLine("1=={0}", log.Messages.Count());
+      log.LogMessage("asdf");
+      log.LogMessage("asdf");
+      Console.WriteLine("3=={0}", log.Messages.Count());
+      
+      ILog log0 = new Log(0);
+      Console.WriteLine("0=={0}", log0.Messages.Count());
+      log0.LogMessage("asdf");
+      Console.WriteLine("0=={0}", log0.Messages.Count());
+      log0.LogMessage("asdf");
+      log0.LogMessage("asdf");
+      log0.LogMessage("asdf");
+      Console.WriteLine("0=={0}", log0.Messages.Count());
+
+      ILog log1 = new Log(1);
+      log1.LogMessage("asdf 1");
+      Console.WriteLine("1=={0}", log1.Messages.Count());
+      log1.LogMessage("asdf 2");
+      log1.LogMessage("asdf 3");
+      Console.WriteLine("1=={0}", log1.Messages.Count());
+      Console.WriteLine("asdf 3=={0}", log1.Messages.First());
     }
 
@@ -271,5 +299,5 @@
       PluginUtil.CollectDeclaringPlugins(plugins, types);
       foreach (var plugin in plugins) {
-        var p = PluginUtil.CreatePlugin(plugin, false);
+        var p = PluginUtil.CreatePlugin(plugin);
         p.Id = Guid.NewGuid();
         lock (locker) {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj	(revision 6431)
@@ -117,8 +117,8 @@
     <Compile Include="StateLogList.cs" />
     <Compile Include="StateLogListList.cs" />
-    <Compile Include="ThreadSafeLog.cs" />
     <None Include="app_f005pc.config" />
     <None Include="app_services.config" />
     <None Include="app.config" />
+    <None Include="ClassDiagram2.cd" />
     <None Include="HeuristicLabClientsHivePlugin.cs.frame" />
     <Compile Include="Exceptions\AddJobToHiveException.cs" />
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/RefreshableHiveExperiment.cs	(revision 6431)
@@ -82,10 +82,8 @@
     }
 
-    private ILog log;
+    private ThreadSafeLog log;
     public ILog Log {
       get { return log; }
-      set { log = value; }
-    }
-    private static object logLocker = new object();
+    }
 
     #region Constructors and Cloning
@@ -93,5 +91,5 @@
       this.refreshAutomatically = true;
       this.HiveExperiment = new HiveExperiment();
-      this.log = new Log();
+      this.log = new ThreadSafeLog(new Log());
       this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
       this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
@@ -100,5 +98,5 @@
       this.refreshAutomatically = true;
       this.HiveExperiment = hiveExperiment;
-      this.log = new Log();
+      this.log = new ThreadSafeLog(new Log());
       this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
       this.jobDownloader.ExceptionOccured += new EventHandler<EventArgs<Exception>>(jobDownloader_ExceptionOccured);
@@ -108,5 +106,5 @@
       this.HiveExperiment = original.HiveExperiment;
       this.IsControllable = original.IsControllable;
-      this.Log = cloner.Clone(original.Log);
+      this.log = cloner.Clone(original.log);
       this.RefreshAutomatically = false; // do not start results polling automatically
       this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
@@ -180,8 +178,8 @@
 
           if (!hiveJob.IsFinishedJobDownloaded && !hiveJob.IsDownloading && hiveJob.Job.LastJobDataUpdate < lightweightJob.LastJobDataUpdate) {
-            LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
+            log.LogMessage(string.Format("Downloading job {0}", lightweightJob.Id));
             hiveJob.IsDownloading = true;
             jobDownloader.DownloadJob(hiveJob.Job, (localJob, itemJob) => {
-              LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
+              log.LogMessage(string.Format("Finished downloading job {0}", localJob.Id));
               HiveJob localHiveJob = GetHiveJobById(localJob.Id);
 
@@ -222,17 +220,4 @@
     }
 
-    // synchronized logging
-    private void LogException(Exception exception) {
-      lock (logLocker) {
-        this.log.LogException(exception);
-      }
-    }
-    // synchronized logging
-    private void LogMessage(string message) {
-      lock (logLocker) {
-        this.log.LogMessage(message);
-      }
-    }
-
     public HiveJob GetHiveJobById(Guid jobId) {
       foreach (HiveJob job in hiveExperiment.HiveJobs) {
@@ -356,5 +341,5 @@
     public event EventHandler<EventArgs<Exception>> ExceptionOccured;
     private void OnExceptionOccured(Exception exception) {
-      LogException(exception);
+      log.LogException(exception);
       var handler = ExceptionOccured;
       if (handler != null) handler(this, new EventArgs<Exception>(exception));
@@ -390,6 +375,5 @@
       get { return hiveExperiment.ItemVersion; }
     }
-
-
+    
     #region IProgressReporter Members
     public IProgress Progress {
Index: anches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ThreadSafeLog.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ThreadSafeLog.cs	(revision 6430)
+++ 	(revision )
@@ -1,127 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2011 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.Drawing;
-using System.Linq;
-using System.Threading;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Clients.Hive {
-  [Item("Log", "A thread-safe log for logging string messages.")]
-  [StorableClass]
-  public class ThreadSafeLog : Item, ILog, IStorableContent {
-    protected ReaderWriterLockSlim locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
-
-    public string Filename { get; set; }
-
-    public override Image ItemImage {
-      get { return HeuristicLab.Common.Resources.VSImageLibrary.File; }
-    }
-
-    public IEnumerable<string> Messages {
-      get {
-        locker.EnterReadLock();
-        try {
-          return log.Messages.ToArray();
-        }
-        finally { locker.ExitReadLock(); }
-      }
-    }
-
-    [Storable]
-    protected ILog log;
-
-    [StorableConstructor]
-    protected ThreadSafeLog(bool deserializing) : base(deserializing) { }
-    protected ThreadSafeLog(ThreadSafeLog original, Cloner cloner)
-      : base(original, cloner) {
-      log = cloner.Clone(original.log);
-    }
-    public ThreadSafeLog(ILog log)
-      : base() {
-      this.log = log;
-      RegisterLogEvents();
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new ThreadSafeLog(this, cloner);
-    }
-
-    public virtual void Clear() {
-      locker.EnterWriteLock();
-      try {
-        log.Clear();
-      }
-      finally { locker.ExitWriteLock(); }
-    }
-    public virtual void LogMessage(string message) {
-      locker.EnterWriteLock();
-      try {
-        log.LogMessage(message);
-      }
-      finally { locker.ExitWriteLock(); }
-    }
-    public virtual void LogException(Exception ex) {
-      locker.EnterWriteLock();
-      try {
-        log.LogException(ex);
-      }
-      finally { locker.ExitWriteLock(); }
-    }
-
-    #region Log Events
-    private void RegisterLogEvents() {
-      this.log.Cleared += new EventHandler(log_Cleared);
-      this.log.MessageAdded += new EventHandler<EventArgs<string>>(log_MessageAdded);
-      this.log.ToStringChanged += new EventHandler(log_ToStringChanged);
-    }
-
-    private void log_ToStringChanged(object sender, EventArgs e) {
-      OnToStringChanged();
-    }
-
-    private void log_MessageAdded(object sender, EventArgs<string> e) {
-      OnMessageAdded(e.Value);
-    }
-
-    private void log_Cleared(object sender, EventArgs e) {
-      OnCleared();
-    }
-    #endregion
-
-    #region Event Handler
-    public event EventHandler<EventArgs<string>> MessageAdded;
-    protected virtual void OnMessageAdded(string message) {
-      EventHandler<EventArgs<string>> handler = MessageAdded;
-      if (handler != null) handler(this, new EventArgs<string>(message));
-    }
-    public event EventHandler Cleared;
-    protected virtual void OnCleared() {
-      EventHandler handler = Cleared;
-      if (handler != null) handler(this, EventArgs.Empty);
-    }
-    #endregion
-  }
-}
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/JobState.cs	(revision 6431)
@@ -34,14 +34,4 @@
     /// </summary>
     Waiting,
-
-    ///// <summary>
-    ///// The job is set to Finished when all child jobs are Finished.
-    ///// </summary>
-    //FinishOnChildJobsFinished,
-
-    ///// <summary>
-    ///// The job is paused and waits on the server to be sent back to a Slave when all of its child jobs are Finished.
-    ///// </summary>
-    //ResumeOnChildJobsFinished,
 
     /// <summary>
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLabServicesHiveCommonPlugin.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLabServicesHiveCommonPlugin.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/HeuristicLabServicesHiveCommonPlugin.cs.frame	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Logger.cs	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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.Diagnostics;
 using System.Security;
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Properties/AssemblyInfo.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/Properties/AssemblyInfo.cs.frame	(revision 6431)
@@ -7,5 +7,5 @@
 // associated with an assembly.
 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Common")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Common classes for HeuristicLab.Hive services")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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;
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj	(revision 6431)
@@ -96,5 +96,4 @@
     <Compile Include="Convert.cs" />
     <None Include="HeuristicLabServicesHiveDataAccessPlugin.cs.frame" />
-    <Compile Include="Exceptions\DaoException.cs" />
     <Compile Include="HeuristicLabServicesHiveDataAccessPlugin.cs" />
     <Compile Include="HiveDao.cs" />
@@ -148,5 +147,6 @@
   </ItemGroup>
   <ItemGroup>
-    <Content Include="Tools\prepareHiveDatabase.sql" />
+    <Content Include="Tools\Initialize Hive Database.sql" />
+    <Content Include="Tools\Prepare Hive Database.sql" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLabServicesHiveDataAccessPlugin.cs.frame	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 6431)
@@ -481,5 +481,5 @@
         if (entity != null) {
           if (db.Resources.Where(r => r.ParentResourceId == id).Count() > 0) {
-            throw new DaoException("Cannot delete SlaveGroup as long as there are Slaves in the group");
+            throw new InvalidOperationException("Cannot delete SlaveGroup as long as there are Slaves in the group");
           }
           db.Resources.DeleteOnSubmit(entity);
@@ -758,5 +758,5 @@
                                           select new {
                                             UserId = g.Key,
-                                            StartToEndTime = g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum()
+                                            StartToEndTime = new TimeSpan(g.Select(x => x.StateLogs.OrderByDescending(sl => sl.DateTime).First().DateTime - x.StateLogs.OrderBy(sl => sl.DateTime).First().DateTime).Sum(ts => ts.Ticks))
                                           };
         foreach (var item in startToEndTimesFinishedJobs) {
@@ -801,9 +801,3 @@
     #endregion
   }
-
-  public static class TimeSpanExtensions {
-    public static TimeSpan Sum(this IEnumerable<TimeSpan> ts) {
-      return new TimeSpan(ts.Sum(r => r.Ticks));
-    }
-  }
 }
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml	(revision 6431)
@@ -16,5 +16,5 @@
       <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
       <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
-      <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20)" CanBeNull="true" />
+      <Column Name="Hash" Type="System.Byte[]" DbType="VarBinary(20) NOT NULL" CanBeNull="false" />
       <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" />
       <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" />
@@ -156,7 +156,7 @@
     <Type Name="DeletedJobStatistics">
       <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
-      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
-      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
-      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
+      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
+      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
+      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
       <Column Name="DeletedJobStatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     </Type>
@@ -166,8 +166,8 @@
       <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
       <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
-      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float" CanBeNull="false" />
-      <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int" CanBeNull="false" />
-      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float" CanBeNull="false" />
-      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float" CanBeNull="false" />
+      <Column Name="ExecutionTimeMs" Storage="_ExecutionTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
+      <Column Name="UsedCores" Storage="_CoresUsed" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="ExecutionTimeMsFinishedJobs" Storage="_ExecutionTimeFinishedJobs" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
+      <Column Name="StartToEndTimeMs" Storage="_StartToEndTime" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
       <Association Name="Statistics_UserStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
     </Type>
@@ -177,9 +177,9 @@
       <Column Name="StatisticsId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
       <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
-      <Column Name="Cores" Type="System.Int32" DbType="Int" CanBeNull="false" />
-      <Column Name="FreeCores" Type="System.Int32" DbType="Int" CanBeNull="false" />
-      <Column Name="CpuUtilization" Type="System.Double" DbType="float" CanBeNull="false" />
-      <Column Name="Memory" Type="System.Int32" DbType="Int" CanBeNull="false" />
-      <Column Name="FreeMemory" Type="System.Int32" DbType="Int" CanBeNull="false" />
+      <Column Name="Cores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="FreeCores" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="CpuUtilization" Type="System.Double" DbType="float NOT NULL" CanBeNull="false" />
+      <Column Name="Memory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
+      <Column Name="FreeMemory" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
       <Association Name="Statistics_SlaveStatistics" Member="Statistics" ThisKey="StatisticsId" OtherKey="StatisticsId" Type="Statistics" IsForeignKey="true" />
     </Type>
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout	(revision 6431)
@@ -76,5 +76,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(7.5 : 4.30930826822917); (7.5 : 4.84780160677083); (8.875 : 4.84780160677083)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
       <nodes>
@@ -116,5 +116,5 @@
       </nestedChildShapes>
     </classShape>
-    <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
       <nodes>
@@ -130,5 +130,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+    <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
       <nodes>
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs	(revision 6431)
@@ -573,5 +573,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20)")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hash", DbType="VarBinary(20) NOT NULL", CanBeNull=false)]
 		public byte[] Hash
 		{
@@ -3505,5 +3505,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")]
 		public double ExecutionTimeMs
 		{
@@ -3525,5 +3525,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")]
 		public double ExecutionTimeMsFinishedJobs
 		{
@@ -3545,5 +3545,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")]
 		public double StartToEndTimeMs
 		{
@@ -3694,5 +3694,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="float NOT NULL")]
 		public double ExecutionTimeMs
 		{
@@ -3714,5 +3714,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresUsed", DbType="Int NOT NULL")]
 		public int UsedCores
 		{
@@ -3734,5 +3734,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTimeFinishedJobs", DbType="float NOT NULL")]
 		public double ExecutionTimeMsFinishedJobs
 		{
@@ -3754,5 +3754,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartToEndTime", DbType="float NOT NULL")]
 		public double StartToEndTimeMs
 		{
@@ -3921,5 +3921,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Cores", DbType="Int NOT NULL")]
 		public int Cores
 		{
@@ -3941,5 +3941,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeCores", DbType="Int NOT NULL")]
 		public int FreeCores
 		{
@@ -3961,5 +3961,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CpuUtilization", DbType="float NOT NULL")]
 		public double CpuUtilization
 		{
@@ -3981,5 +3981,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Memory", DbType="Int NOT NULL")]
 		public int Memory
 		{
@@ -4001,5 +4001,5 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int")]
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FreeMemory", DbType="Int NOT NULL")]
 		public int FreeMemory
 		{
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs	(revision 6431)
@@ -1,10 +1,30 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq.Expressions;
+using HeuristicLab.Services.Hive.Common.DataTransfer;
+using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
 
 namespace HeuristicLab.Services.Hive.DataAccess {
-  using HeuristicLab.Services.Hive.Common.DataTransfer;
-  using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
-
   public interface IHiveDao {
     #region Job Methods
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Properties/AssemblyInfo.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Properties/AssemblyInfo.cs.frame	(revision 6431)
@@ -7,5 +7,5 @@
 // associated with an assembly.
 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Server.DataAccess")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Data access layer for HeuristicLab.Hive database")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs	(revision 6431)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -20,7 +20,7 @@
 #endregion
 
-using HeuristicLab.PluginInfrastructure;
 using System.IO;
 using System.Windows.Forms;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Services.Hive.DataAccess {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Initialize Hive Database.sql
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Initialize Hive Database.sql	(revision 6431)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Initialize Hive Database.sql	(revision 6431)
@@ -0,0 +1,178 @@
+﻿USE [HeuristicLab.Hive-3.4]
+/* create and initialize hive database tables */
+
+SET ARITHABORT ON
+CREATE TABLE [dbo].[AssignedResources](
+  [ResourceId] UniqueIdentifier NOT NULL, 
+  [JobId] UniqueIdentifier NOT NULL, 
+  [AssignedRessourcesId] UniqueIdentifier NOT NULL, 
+  CONSTRAINT [PK_dbo.AssignedResources] PRIMARY KEY ([AssignedRessourcesId])
+  )
+CREATE TABLE [dbo].[Plugin](
+  [PluginId] UniqueIdentifier NOT NULL, 
+  [Name] VarChar(MAX), 
+  [Version] VarChar(MAX), 
+  [UserId] UniqueIdentifier, 
+  [DateCreated] DateTime, 
+  [Hash] VarBinary(20), 
+  CONSTRAINT [PK_dbo.Plugin] PRIMARY KEY ([PluginId])
+  )
+CREATE TABLE [dbo].[RequiredPlugins](
+  [RequiredPluginId] UniqueIdentifier NOT NULL, 
+  [JobId] UniqueIdentifier NOT NULL, 
+  [PluginId] UniqueIdentifier NOT NULL, 
+  CONSTRAINT [PK_dbo.RequiredPlugins] PRIMARY KEY ([RequiredPluginId])
+  )
+CREATE TABLE [dbo].[Resource](
+  [ResourceId] UniqueIdentifier NOT NULL, 
+  [Name] VarChar(MAX), 
+  [ResourceType] NVarChar(4000) NOT NULL, 
+  [ParentResourceId] UniqueIdentifier, 
+  [CpuSpeed] Int, 
+  [Memory] Int, 
+  [Login] DateTime, 
+  [SlaveState] VarChar(15), 
+  [Cores] Int, 
+  [FreeCores] Int, 
+  [FreeMemory] Int, 
+  [IsAllowedToCalculate] Bit, 
+  [CpuArchitecture] VarChar(3), 
+  [OperatingSystem] VarChar(MAX), 
+  [LastHeartbeat] DateTime, 
+  [CpuUtilization] float, 
+  CONSTRAINT [PK_dbo.Resource] PRIMARY KEY ([ResourceId])
+  )
+CREATE TABLE [dbo].[Job](
+  [JobId] UniqueIdentifier NOT NULL, 
+  [JobState] VarChar(30), 
+  [ExecutionTimeMs] float, 
+  [LastHeartbeat] DateTime, 
+  [ParentJobId] UniqueIdentifier, 
+  [Priority] Int NOT NULL, 
+  [CoresNeeded] Int NOT NULL, 
+  [MemoryNeeded] Int NOT NULL, 
+  [IsParentJob] Bit, 
+  [FinishWhenChildJobsFinished] Bit, 
+  [Command] VarChar(30), 
+  [HiveExperimentId] UniqueIdentifier NOT NULL, 
+  [IsPrivileged] Bit, 
+  CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
+  )
+CREATE TABLE [dbo].[UptimeCalendar](
+  [UptimeCalendarId] UniqueIdentifier, 
+  [ResourceId] UniqueIdentifier, 
+  [StartDate] DateTime, 
+  [EndDate] DateTime, 
+  [AllDayEvent] Bit, 
+  [Recurring] Bit, 
+  [RecurringId] UniqueIdentifier, 
+  CONSTRAINT [PK_dbo.UptimeCalendar] PRIMARY KEY ([UptimeCalendarId])
+  )
+CREATE TABLE [dbo].[HiveExperiment](
+  [HiveExperimentId] UniqueIdentifier NOT NULL, 
+  [Name] VarChar(MAX), 
+  [Description] VarChar(MAX), 
+  [ResourceIds] VarChar(MAX), 
+  [OwnerUserId] UniqueIdentifier, 
+  [DateCreated] DateTime, 
+  [LastAccessed] DateTime, 
+  [IsHiveEngine] Bit, 
+  CONSTRAINT [PK_dbo.HiveExperiment] PRIMARY KEY ([HiveExperimentId])
+  )
+CREATE TABLE [dbo].[JobData](
+  [JobId] UniqueIdentifier NOT NULL, 
+  [Data] VarBinary(MAX), 
+  [LastUpdate] DateTime, 
+  CONSTRAINT [PK_dbo.JobData] PRIMARY KEY ([JobId])
+  )
+CREATE TABLE [dbo].[PluginData](
+  [PluginDataId] UniqueIdentifier NOT NULL, 
+  [PluginId] UniqueIdentifier NOT NULL, 
+  [Data] VarBinary(MAX) NOT NULL, 
+  [FileName] VarChar(MAX), 
+  CONSTRAINT [PK_dbo.PluginData] PRIMARY KEY ([PluginDataId])
+  )
+CREATE TABLE [dbo].[StateLog](
+  [StateLogId] UniqueIdentifier NOT NULL, 
+  [State] VarChar(30) NOT NULL, 
+  [DateTime] DateTime NOT NULL, 
+  [JobId] UniqueIdentifier NOT NULL, 
+  [UserId] UniqueIdentifier, 
+  [SlaveId] UniqueIdentifier, 
+  [Exception] VarChar(MAX), 
+  CONSTRAINT [PK_dbo.StateLog] PRIMARY KEY ([StateLogId])
+  )
+CREATE TABLE [dbo].[HiveExperimentPermission](
+  [HiveExperimentId] UniqueIdentifier NOT NULL, 
+  [GrantedUserId] UniqueIdentifier NOT NULL, 
+  [GrantedByUserId] UniqueIdentifier NOT NULL, 
+  [Permission] VarChar(15) NOT NULL, 
+  CONSTRAINT [PK_dbo.HiveExperimentPermission] PRIMARY KEY ([HiveExperimentId], [GrantedUserId])
+  )
+CREATE TABLE [Lifecycle](
+  [LifecycleId] Int, 
+  [LastCleanup] DateTime, 
+  CONSTRAINT [PK_Lifecycle] PRIMARY KEY ([LifecycleId])
+  )
+CREATE TABLE [DeletedJobStatistics](
+  [UserId] UniqueIdentifier NOT NULL, 
+  [ExecutionTimeMs] float NOT NULL, 
+  [ExecutionTimeMsFinishedJobs] float NOT NULL, 
+  [StartToEndTimeMs] float NOT NULL, 
+  [DeletedJobStatisticsId] UniqueIdentifier NOT NULL, 
+  CONSTRAINT [PK_DeletedJobStatistics] PRIMARY KEY ([DeletedJobStatisticsId])
+  )
+CREATE TABLE [UserStatistics](
+  [StatisticsId] UniqueIdentifier NOT NULL, 
+  [UserId] UniqueIdentifier NOT NULL, 
+  [ExecutionTimeMs] float NOT NULL, 
+  [UsedCores] Int NOT NULL, 
+  [ExecutionTimeMsFinishedJobs] float NOT NULL, 
+  [StartToEndTimeMs] float NOT NULL, 
+  CONSTRAINT [PK_UserStatistics] PRIMARY KEY ([StatisticsId], [UserId])
+  )
+CREATE TABLE [SlaveStatistics](
+  [StatisticsId] UniqueIdentifier NOT NULL, 
+  [SlaveId] UniqueIdentifier NOT NULL, 
+  [Cores] Int NOT NULL, 
+  [FreeCores] Int NOT NULL, 
+  [CpuUtilization] float NOT NULL, 
+  [Memory] Int NOT NULL, 
+  [FreeMemory] Int NOT NULL, 
+  CONSTRAINT [PK_SlaveStatistics] PRIMARY KEY ([StatisticsId], [SlaveId])
+  )
+CREATE TABLE [Statistics](
+  [StatisticsId] UniqueIdentifier NOT NULL, 
+  [Timestamp] DateTime NOT NULL, 
+  CONSTRAINT [PK_Statistics] PRIMARY KEY ([StatisticsId])
+  )
+ALTER TABLE [dbo].[AssignedResources]
+  ADD CONSTRAINT [Resource_AssignedResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
+ALTER TABLE [dbo].[AssignedResources]
+  ADD CONSTRAINT [Job_AssignedResource] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
+ALTER TABLE [dbo].[RequiredPlugins]
+  ADD CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
+ALTER TABLE [dbo].[RequiredPlugins]
+  ADD CONSTRAINT [Job_RequiredPlugin] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
+ALTER TABLE [dbo].[Resource]
+  ADD CONSTRAINT [Resource_Resource] FOREIGN KEY ([ParentResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
+ALTER TABLE [dbo].[Job]
+  ADD CONSTRAINT [Job_Job] FOREIGN KEY ([ParentJobId]) REFERENCES [dbo].[Job]([JobId])
+ALTER TABLE [dbo].[Job]
+  ADD CONSTRAINT [HiveExperiment_Job] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
+ALTER TABLE [dbo].[UptimeCalendar]
+  ADD CONSTRAINT [Resource_UptimeCalendar] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
+ALTER TABLE [dbo].[JobData]
+  ADD CONSTRAINT [Job_JobData] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
+ALTER TABLE [dbo].[PluginData]
+  ADD CONSTRAINT [Plugin_PluginData] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
+ALTER TABLE [dbo].[StateLog]
+  ADD CONSTRAINT [Job_StateLog] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
+ALTER TABLE [dbo].[StateLog]
+  ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY ([SlaveId]) REFERENCES [dbo].[Resource]([ResourceId])
+ALTER TABLE [dbo].[HiveExperimentPermission]
+  ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
+ALTER TABLE [UserStatistics]
+  ADD CONSTRAINT [Statistics_UserStatistics] FOREIGN KEY ([StatisticsId]) REFERENCES [Statistics]([StatisticsId])
+ALTER TABLE [SlaveStatistics]
+  ADD CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY ([StatisticsId]) REFERENCES [Statistics]([StatisticsId])
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Prepare Hive Database.sql
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Prepare Hive Database.sql	(revision 6431)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/Prepare Hive Database.sql	(revision 6431)
@@ -0,0 +1,246 @@
+USE [HeuristicLab.Hive-3.4]
+/* this script is supposed to be executed after the plain DB is generated by the linq-to-sql schema */
+/* adds default values */
+/* creates delete and update cascades */
+/* creates indices */
+/* creates views */
+/* creates triggers */
+
+
+ALTER TABLE dbo.AssignedResources ALTER COLUMN AssignedRessourcesId ADD ROWGUIDCOL;
+ALTER TABLE dbo.AssignedResources WITH NOCHECK ADD CONSTRAINT [DF_AssignedResources_AssignedRessourcesId] DEFAULT (NEWSEQUENTIALID()) FOR AssignedRessourcesId;
+ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Job_AssignedResource]
+ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Job_AssignedResource] FOREIGN KEY([JobId])
+REFERENCES [dbo].[Job] ([JobId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+ALTER TABLE [dbo].[AssignedResources]  DROP  CONSTRAINT [Resource_AssignedResource]
+ALTER TABLE [dbo].[AssignedResources]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId])
+REFERENCES [dbo].[Resource] ([ResourceId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
+ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (NEWSEQUENTIALID()) FOR JobId;
+GO
+
+ALTER TABLE [dbo].[StateLog]  DROP  CONSTRAINT [Job_StateLog]
+ALTER TABLE [dbo].[StateLog]  WITH CHECK ADD CONSTRAINT [Job_StateLog] FOREIGN KEY([JobId])
+REFERENCES [dbo].[Job] ([JobId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+ALTER TABLE [dbo].[StateLog]  DROP  CONSTRAINT [Resource_StateLog]
+ALTER TABLE [dbo].[StateLog]  WITH CHECK ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY([SlaveId])
+REFERENCES [dbo].[Resource] ([ResourceId])
+ON UPDATE CASCADE
+ON DELETE SET NULL
+GO
+
+ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL;
+ALTER TABLE dbo.Plugin WITH NOCHECK ADD CONSTRAINT [DF_Plugin_PluginId] DEFAULT (NEWSEQUENTIALID()) FOR PluginId;
+
+ALTER TABLE dbo.PluginData ALTER COLUMN PluginDataId ADD ROWGUIDCOL;
+ALTER TABLE dbo.PluginData WITH NOCHECK ADD CONSTRAINT [DF_PluginData_PluginDataId] DEFAULT (NEWSEQUENTIALID()) FOR PluginDataId;
+
+ALTER TABLE [dbo].[PluginData]  DROP  CONSTRAINT [Plugin_PluginData]
+ALTER TABLE [dbo].[PluginData]  WITH CHECK ADD  CONSTRAINT [Plugin_PluginData] FOREIGN KEY([PluginId])
+REFERENCES [dbo].[Plugin] ([PluginId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL;
+ALTER TABLE dbo.RequiredPlugins WITH NOCHECK ADD CONSTRAINT [DF_RequiredPlugins_RequiredPluginId] DEFAULT (NEWSEQUENTIALID()) FOR RequiredPluginId;
+
+ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [Job_RequiredPlugin]
+ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [Job_RequiredPlugin] FOREIGN KEY([JobId])
+REFERENCES [dbo].[Job] ([JobId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE [dbo].[RequiredPlugins]  DROP  CONSTRAINT [Plugin_RequiredPlugin]
+ALTER TABLE [dbo].[RequiredPlugins]  WITH CHECK ADD  CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY([PluginId])
+REFERENCES [dbo].[Plugin] ([PluginId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE dbo.Resource ALTER COLUMN ResourceId ADD ROWGUIDCOL;
+ALTER TABLE dbo.Resource WITH NOCHECK ADD CONSTRAINT [DF_Resource_ResourceId] DEFAULT (NEWSEQUENTIALID()) FOR ResourceId;
+
+ALTER TABLE dbo.UptimeCalendar ALTER COLUMN UptimeCalendarId ADD ROWGUIDCOL;
+ALTER TABLE dbo.UptimeCalendar WITH NOCHECK ADD CONSTRAINT [DF_UptimeCalendar_UptimeCalendarId] DEFAULT (NEWSEQUENTIALID()) FOR UptimeCalendarId;
+
+ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL;
+ALTER TABLE dbo.HiveExperiment WITH NOCHECK ADD CONSTRAINT [DF_HiveExperiment_HiveExperimentId] DEFAULT (NEWSEQUENTIALID()) FOR HiveExperimentId;
+
+ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL;
+ALTER TABLE dbo.StateLog WITH NOCHECK ADD CONSTRAINT [DF_StateLog_StateLogId] DEFAULT (NEWSEQUENTIALID()) FOR StateLogId;
+
+ALTER TABLE [dbo].[HiveExperimentPermission]  DROP  CONSTRAINT [HiveExperiment_HiveExperimentPermission]
+ALTER TABLE [dbo].[HiveExperimentPermission]  WITH CHECK ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY([HiveExperimentId])
+REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE [dbo].[Statistics] ALTER COLUMN StatisticsId ADD ROWGUIDCOL;
+ALTER TABLE [dbo].[Statistics] WITH NOCHECK ADD CONSTRAINT [DF_Statistics_StatisticsId] DEFAULT (NEWSEQUENTIALID()) FOR StatisticsId;
+GO
+
+ALTER TABLE [dbo].[DeletedJobStatistics] ALTER COLUMN DeletedJobStatisticsId ADD ROWGUIDCOL;
+ALTER TABLE [dbo].[DeletedJobStatistics] WITH NOCHECK ADD CONSTRAINT [DF_DeletedJobStatistics_DeletedJobStatisticsId] DEFAULT (NEWSEQUENTIALID()) FOR DeletedJobStatisticsId;
+GO
+
+ALTER TABLE [dbo].[SlaveStatistics]  DROP  CONSTRAINT [Statistics_SlaveStatistics]
+ALTER TABLE [dbo].[SlaveStatistics]  WITH CHECK ADD  CONSTRAINT [Statistics_SlaveStatistics] FOREIGN KEY([StatisticsId])
+REFERENCES [dbo].[Statistics] ([StatisticsId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+ALTER TABLE [dbo].[UserStatistics]  DROP  CONSTRAINT [Statistics_UserStatistics]
+ALTER TABLE [dbo].[UserStatistics]  WITH CHECK ADD  CONSTRAINT [Statistics_UserStatistics] FOREIGN KEY([StatisticsId])
+REFERENCES [dbo].[Statistics] ([StatisticsId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
+
+/* create indices */
+CREATE INDEX Index_RequiredPlugins_JobId ON RequiredPlugins(JobId);
+GO
+
+/* views */
+-- =============================================
+-- Author:		cneumuel
+-- Description:	Returns the first StateLog entry for each job
+-- =============================================
+CREATE VIEW [dbo].[view_FirstState]
+AS
+SELECT     sl.JobId, sl.DateTime, sl.State
+FROM         dbo.StateLog AS sl INNER JOIN
+                          (SELECT     JobId, MIN(DateTime) AS DateTime
+                            FROM          dbo.StateLog
+                            GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
+
+GO
+
+-- =============================================
+-- Author:		cneumuel
+-- Description:	Returns the last StateLog entry for each job
+-- =============================================
+CREATE VIEW [dbo].[view_LastState]
+AS
+SELECT     sl.JobId, sl.DateTime, sl.State
+FROM         dbo.StateLog AS sl INNER JOIN
+                          (SELECT     JobId, MAX(DateTime) AS DateTime
+                            FROM          dbo.StateLog
+                            GROUP BY JobId) AS minDate ON sl.DateTime = minDate.DateTime AND sl.JobId = minDate.JobId
+GO
+
+-- =============================================
+-- Author:		cneumuel
+-- Description:	returns aggregates statistic information for every minute
+-- =============================================
+CREATE VIEW [dbo].[view_Statistics]
+AS
+SELECT  CONVERT(VARCHAR(19), MIN(s.Timestamp), 120) AS DateTime, SUM(ss.Cores) AS Cores, SUM(ss.FreeCores) AS FreeCores, 
+        AVG(ss.CpuUtilization) AS CpuUtilization, SUM(ss.Memory) AS Memory, SUM(ss.FreeMemory) AS FreeMemory, x.exSum AS ExecutionTimeHours, 
+        x.exFinishedSum AS ExecutionTimeFinished, x.exStartToEndSum AS StartToEndTimeFinished
+FROM         dbo.SlaveStatistics AS ss INNER JOIN
+                      dbo.[Statistics] AS s ON ss.StatisticsId = s.StatisticsId INNER JOIN
+                      dbo.Resource AS r ON ss.SlaveId = r.ResourceId INNER JOIN
+                          (SELECT     StatisticsId, SUM(ExecutionTimeMs) / 1000 / 60 / 60 AS exSum, SUM(ExecutionTimeMsFinishedJobs) / 1000 / 60 / 60 AS exFinishedSum, 
+                                                   SUM(StartToEndTimeMs) / 1000 / 60 / 60 AS exStartToEndSum
+                            FROM          dbo.UserStatistics AS us
+                            GROUP BY StatisticsId) AS x ON s.StatisticsId = x.StatisticsId
+GROUP BY s.StatisticsId, x.exSum, x.exFinishedSum, x.exStartToEndSum
+
+/* triggers */
+GO
+/****** Object:  Trigger [dbo].[tr_HiveExperimentDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
+SET ANSI_NULLS ON
+GO
+SET QUOTED_IDENTIFIER ON
+GO
+-- =============================================
+-- Author:		cneumuel
+-- Create date: 19.04.2011
+-- Description:	(1) Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics
+--				(2) Deletes all associated jobs. This cannot be done with cascading delete, 
+--              because the job table defines a INSTEAD OF DELETE trigger itself, which
+--              is not compatible with cascading deletes.
+-- =============================================
+CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] INSTEAD OF DELETE AS 
+BEGIN
+	DELETE Job FROM deleted, Job WHERE deleted.HiveExperimentId = Job.HiveExperimentId
+	DELETE HiveExperiment FROM deleted, HiveExperiment WHERE deleted.HiveExperimentId = HiveExperiment.HiveExperimentId
+END
+GO
+
+-- =============================================
+-- Author:		cneumuel
+-- Create date: 11.11.2010
+-- Description:	Recursively deletes all child-jobs of a job when it is deleted. (Source: http://devio.wordpress.com/2008/05/23/recursive-delete-in-sql-server/)
+-- =============================================
+CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS 
+BEGIN
+	-- add statistics
+	INSERT INTO dbo.DeletedJobStatistics (UserId, ExecutionTimeMs, ExecutionTimeMsFinishedJobs, StartToEndTimeMs)
+	SELECT 
+		he.OwnerUserId AS UserId, 
+		SUM(j.ExecutionTimeMs) AS ExecutionTimeMs, 
+		ISNULL(SUM(CASE ls.State WHEN 'Finished' THEN j.ExecutionTimeMs END), 0) AS ExecutionTimeMsFinishedJobs,
+		ISNULL(SUM(CASE ls.State WHEN 'Finished' THEN DATEDIFF(MS,fs.DateTime,ls.DateTime) ELSE 0 END), 0) AS StartToEndMs
+	FROM 
+		deleted j, 
+		HiveExperiment he, 
+		view_FirstState fs, 
+		view_LastState ls
+	WHERE 
+		he.HiveExperimentId = j.HiveExperimentId AND 
+		fs.JobId = j.JobId AND 
+		ls.JobId = j.JobId
+	GROUP BY he.OwnerUserId
+
+	-- recursively delete jobs
+	CREATE TABLE #Table( 
+		JobId uniqueidentifier 
+	)
+	INSERT INTO #Table (JobId)
+	SELECT JobId FROM deleted
+	
+	DECLARE @c INT
+	SET @c = 0
+	
+	WHILE @c <> (SELECT COUNT(JobId) FROM #Table) BEGIN
+		SELECT @c = COUNT(JobId) FROM #Table
+		
+		INSERT INTO #Table (JobId)
+			SELECT Job.JobId
+			FROM Job
+			LEFT OUTER JOIN #Table ON Job.JobId = #Table.JobId
+			WHERE Job.ParentJobId IN (SELECT JobId FROM #Table)
+				AND #Table.JobId IS NULL
+	END
+	
+	DELETE JobData FROM JobData INNER JOIN #Table ON JobData.JobId = #Table.JobId
+	DELETE Job FROM Job INNER JOIN #Table ON Job.JobId = #Table.JobId
+END
+GO
+
+-- =============================================
+-- Author:		cneumuel
+-- Create date: 17.05.2011
+-- Description:	Writes the execution times of deleted jobs into DeletedJobStats to ensure correct statistics
+-- =============================================
+--CREATE TRIGGER [dbo].[tr_DeletedJobStats] ON [dbo].[Job] AFTER DELETE AS
+--BEGIN
+
+
+--END
+--GO
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/TransactionManager.cs	(revision 6431)
@@ -25,6 +25,6 @@
 
 namespace HeuristicLab.Services.Hive.DataAccess {
-  public class TransactionManager {
-    public void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {
+  public static class TransactionManager {
+    public static void UseTransaction(Action call, bool serializable = false, bool longRunning = false) {
       TransactionScope transaction = CreateTransaction(serializable, longRunning);
       try {
@@ -37,5 +37,5 @@
     }
 
-    public T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {
+    public static T UseTransaction<T>(Func<T> call, bool serializable = false, bool longRunning = false) {
       TransactionScope transaction = CreateTransaction(serializable, longRunning);
       try {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs	(revision 6431)
@@ -1,14 +1,34 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
 using System.Linq;
+using System.Threading;
 using HeuristicLab.Services.Hive.Common.DataTransfer;
 using HeuristicLab.Services.Hive.Common.ServiceContracts;
 using HeuristicLab.Services.Hive.DataAccess;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
 
 namespace HeuristicLab.Services.Hive.Tests {
-  using System.Collections.Generic;
-  using System.Threading;
-  using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
-
   [TestClass]
   public class DaoTests {
@@ -49,5 +69,4 @@
       plugin1.Version = new Version("1.0.0.0");
       plugin1.UserId = Guid.Empty;
-      plugin1.IsLocal = true;
       plugin1.DateCreated = DateTime.Now;
 
@@ -155,5 +174,4 @@
       DT.Plugin plugin1 = new DT.Plugin();
       plugin1.DateCreated = DateTime.Now;
-      plugin1.IsLocal = false;
       plugin1.Name = "Tests.MyPlugin";
       plugin1.Version = new Version("1.0.0.0");
@@ -168,5 +186,4 @@
       Assert.AreEqual(plugin1.UserId, plugin1loaded.UserId);
       Assert.AreEqual(plugin1.DateCreated.ToString(), plugin1loaded.DateCreated.ToString());
-      Assert.AreEqual(plugin1.IsLocal, plugin1loaded.IsLocal);
 
       DT.PluginData pluginData1 = new DT.PluginData();
@@ -264,5 +281,5 @@
       Assert.IsTrue(Math.Abs((stats.TimeStamp - statsLoaded.TimeStamp).TotalSeconds) < 1);
 
-      for (int i = 0; i  < slaveStats.Count; i ++) {
+      for (int i = 0; i < slaveStats.Count; i++) {
         Assert.AreEqual(slaveStats[i].Cores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).Cores);
         Assert.AreEqual(slaveStats[i].FreeCores, statsLoaded.SlaveStatistics.Single(x => x.SlaveId == slaveStats[i].SlaveId).FreeCores);
@@ -274,5 +291,5 @@
       for (int i = 0; i < userStats.Count; i++) {
         Assert.AreEqual(userStats[i].ExecutionTime, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).ExecutionTime);
-        Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores);        
+        Assert.AreEqual(userStats[i].UsedCores, statsLoaded.UserStatistics.Single(x => x.UserId == userStats[i].UserId).UsedCores);
       }
 
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs	(revision 6431)
@@ -49,8 +49,4 @@
     }
 
-    public TransactionManager TransactionManager {
-      get { return defaultServiceLocator.TransactionManager; }
-    }
-
     public HeartbeatManager HeartbeatManager {
       get {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Properties/AssemblyInfo.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Properties/AssemblyInfo.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Properties/AssemblyInfo.cs	(revision 6431)
@@ -1,4 +1,3 @@
 ﻿using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
@@ -7,5 +6,5 @@
 // associated with an assembly.
 [assembly: AssemblyTitle("HeuristicLab.Services.Hive.Tests")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Unit tests for HeuristicLab.Hive services")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("Microsoft")]
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs	(revision 6431)
@@ -23,13 +23,11 @@
 using System.Collections.Generic;
 using System.Linq;
+using HeuristicLab.Services.Hive.Common;
+using HeuristicLab.Services.Hive.Common.DataTransfer;
+using HeuristicLab.Services.Hive.Common.ServiceContracts;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
 
 namespace HeuristicLab.Services.Hive.Tests {
-
-  using HeuristicLab.Services.Hive.Common;
-  using HeuristicLab.Services.Hive.Common.DataTransfer;
-  using HeuristicLab.Services.Hive.Common.ServiceContracts;
-  using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
-
   [TestClass]
   public class ServiceTests {
@@ -73,5 +71,4 @@
       plugin1.Version = new Version("1.0.0.0");
       plugin1.UserId = Guid.Empty;
-      plugin1.IsLocal = true;
       plugin1.DateCreated = DateTime.Now;
 
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeartbeatManager.cs	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,7 +30,4 @@
     private DataAccess.IHiveDao dao {
       get { return ServiceLocator.Instance.HiveDao; }
-    }
-    private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
-      get { return ServiceLocator.Instance.TransactionManager; }
     }
     private IAuthorizationManager auth {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLabServicesHivePlugin.cs.frame	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using System;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -6,4 +27,5 @@
 using HeuristicLab.Services.Hive.Common.DataTransfer;
 using HeuristicLab.Services.Hive.Common.ServiceContracts;
+using DA = HeuristicLab.Services.Hive.DataAccess;
 
 namespace HeuristicLab.Services.Hive {
@@ -18,7 +40,4 @@
       get { return ServiceLocator.Instance.HiveDao; }
     }
-    private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
-      get { return ServiceLocator.Instance.TransactionManager; }
-    }
     private IAuthenticationManager authen {
       get { return ServiceLocator.Instance.AuthenticationManager; }
@@ -37,5 +56,5 @@
     public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         job.Id = dao.AddJob(job);
         jobData.JobId = job.Id;
@@ -52,5 +71,5 @@
     public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         job.ParentJobId = parentJobId;
         return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));
@@ -90,5 +109,5 @@
     public void UpdateJob(Job job) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.UpdateJob(job);
       });
@@ -97,5 +116,5 @@
     public void UpdateJobData(Job job, JobData jobData) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      //trans.UseTransaction(() => { // cneumuel: try without transaction
+      //DA.TransactionManager.UseTransaction(() => { // cneumuel: try without transaction
       jobData.LastUpdate = DateTime.Now;
       dao.UpdateJob(job);
@@ -106,5 +125,5 @@
     public void DeleteJob(Guid jobId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.DeleteJob(jobId);
       });
@@ -113,5 +132,5 @@
     public void DeleteChildJobs(Guid parentJobId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var jobs = GetChildJobs(parentJobId, true, false);
         foreach (var job in jobs) {
@@ -124,5 +143,5 @@
     public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception);
 
@@ -147,5 +166,5 @@
     public void StopJob(Guid jobId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var job = dao.GetJob(jobId);
         if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
@@ -162,5 +181,5 @@
     public void PauseJob(Guid jobId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var job = dao.GetJob(jobId);
         if (job.State == JobState.Calculating || job.State == JobState.Transferring) {
@@ -175,5 +194,5 @@
     public void RestartJob(Guid jobId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, author.UserId, string.Empty);
         job.Command = null;
@@ -204,5 +223,5 @@
     public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         hiveExperimentDto.OwnerUserId = author.UserId;
         hiveExperimentDto.DateCreated = DateTime.Now;
@@ -213,5 +232,5 @@
     public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.UpdateHiveExperiment(hiveExperimentDto);
       });
@@ -220,5 +239,5 @@
     public void DeleteHiveExperiment(Guid hiveExperimentId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
         dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger
@@ -230,5 +249,5 @@
     public void Hello(Slave slaveInfo) {
       authen.AuthenticateForAnyRole(HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var slave = dao.GetSlave(slaveInfo.Id);
 
@@ -261,5 +280,5 @@
     public void GoodBye(Guid slaveId) {
       authen.AuthenticateForAnyRole(HiveRoles.Slave);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var slave = dao.GetSlave(slaveId);
         if (slave != null) {
@@ -275,5 +294,5 @@
       authen.AuthenticateForAnyRole(HiveRoles.Slave);
       TriggerLifecycle(false);
-      return trans.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));
+      return DA.TransactionManager.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat));
     }
     #endregion
@@ -282,5 +301,5 @@
     public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         plugin.UserId = author.UserId;
         plugin.DateCreated = DateTime.Now;
@@ -315,5 +334,5 @@
       List<PluginData> pluginDatas = new List<PluginData>();
 
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         foreach (Guid guid in pluginIds) {
           pluginDatas.AddRange(dao.GetPluginDatas(x => x.PluginId == guid).ToList());
@@ -328,10 +347,10 @@
     public Guid AddSlave(Slave slave) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => dao.AddSlave(slave));
+      return DA.TransactionManager.UseTransaction(() => dao.AddSlave(slave));
     }
 
     public Guid AddSlaveGroup(SlaveGroup slaveGroup) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
+      return DA.TransactionManager.UseTransaction(() => dao.AddSlaveGroup(slaveGroup));
     }
 
@@ -358,5 +377,5 @@
     public void UpdateSlave(Slave slave) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.UpdateSlave(slave);
       });
@@ -365,5 +384,5 @@
     public void UpdateSlaveGroup(SlaveGroup slaveGroup) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.UpdateSlaveGroup(slaveGroup);
       });
@@ -372,5 +391,5 @@
     public void DeleteSlave(Guid slaveId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.DeleteSlave(slaveId);
       });
@@ -379,5 +398,5 @@
     public void DeleteSlaveGroup(Guid slaveGroupId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.DeleteSlaveGroup(slaveGroupId);
       });
@@ -386,5 +405,5 @@
     public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var resource = dao.GetResource(resourceId);
         resource.ParentResourceId = slaveGroupId;
@@ -395,5 +414,5 @@
     public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         var resource = dao.GetResource(resourceId);
         resource.ParentResourceId = null;
@@ -404,5 +423,5 @@
     public Guid GetResourceId(string resourceName) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
+      return DA.TransactionManager.UseTransaction(() => {
         var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault();
         if (resource != null) {
@@ -416,5 +435,5 @@
     public void TriggerLifecycle(bool force) {
       // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains)
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         DateTime lastCleanup = dao.GetLastCleanup();
         if (force || DateTime.Now - lastCleanup > TimeSpan.FromSeconds(59)) {
@@ -446,10 +465,10 @@
     public Guid AddAppointment(Appointment appointment) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      return trans.UseTransaction(() => dao.AddAppointment(appointment));
+      return DA.TransactionManager.UseTransaction(() => dao.AddAppointment(appointment));
     }
 
     public void DeleteAppointment(Guid appointmentId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.DeleteAppointment(appointmentId);
       });
@@ -458,5 +477,5 @@
     public void UpdateAppointment(Appointment appointment) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      trans.UseTransaction(() => {
+      DA.TransactionManager.UseTransaction(() => {
         dao.UpdateAppointment(appointment);
       });
@@ -465,10 +484,10 @@
     public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
+      return DA.TransactionManager.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId));
     }
 
     public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) {
       authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
+      return DA.TransactionManager.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
     }
     #endregion
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs	(revision 6431)
@@ -28,5 +28,4 @@
     IHiveDao HiveDao { get; }
     ILifecycleManager LifecycleManager { get; }
-    TransactionManager TransactionManager { get; }
     HeartbeatManager HeartbeatManager { get; }
   }
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/LifecycleManager.cs	(revision 6431)
@@ -33,7 +33,4 @@
     private DataAccess.IHiveDao dao {
       get { return ServiceLocator.Instance.HiveDao; }
-    }
-    private HeuristicLab.Services.Hive.DataAccess.TransactionManager trans {
-      get { return ServiceLocator.Instance.TransactionManager; }
     }
     private IAuthorizationManager auth {
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Properties/AssemblyInfo.cs.frame	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Properties/AssemblyInfo.cs.frame	(revision 6431)
@@ -7,5 +7,5 @@
 // associated with an assembly.
 [assembly: AssemblyTitle("HeuristicLab.Services.Hive")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Business logic for HeuristicLab.Hive services")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
Index: /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs
===================================================================
--- /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs	(revision 6430)
+++ /branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs	(revision 6431)
@@ -1,3 +1,24 @@
-﻿using HeuristicLab.Services.Hive.DataAccess;
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2011 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 HeuristicLab.Services.Hive.DataAccess;
 
 namespace HeuristicLab.Services.Hive {
@@ -18,12 +39,4 @@
         if (hiveDao == null) hiveDao = new HiveDao();
         return hiveDao;
-      }
-    }
-    
-    private TransactionManager transactionManager;
-    public TransactionManager TransactionManager {
-      get {
-        if (transactionManager == null) transactionManager = new TransactionManager();
-        return transactionManager;
       }
     }
