Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelation.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelation.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelation.cs	(revision 1529)
@@ -0,0 +1,11 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public class BinaryRelation: PersistableObject {
+    public Guid Id2 { get; set; }
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelationHelper.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelationHelper.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/BinaryRelationHelper.cs	(revision 1529)
@@ -0,0 +1,93 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public class BinaryRelationHelper<AdapterT, RowT>
+    where AdapterT : new()
+    where RowT : System.Data.DataRow
+    {
+    IDataAdapterWrapper<AdapterT, BinaryRelation, RowT> tableAdapterWrapper;
+    
+    public BinaryRelationHelper(
+      IDataAdapterWrapper<AdapterT, BinaryRelation, RowT> tableAdapterWrapper) {
+      this.tableAdapterWrapper = tableAdapterWrapper;
+    }
+
+    public Session Session {
+      set {
+        tableAdapterWrapper.Session = value;
+      }
+    }
+
+    public void UpdateRelationships(Guid objectA, IList<Guid> relationships) {
+      //firstly check for created references
+      IList<Guid> existing =
+        this.GetRelationships(objectA);
+
+      foreach (Guid relationship in relationships) {
+        if (!existing.Contains(relationship)) {
+          BinaryRelation rel = 
+            new BinaryRelation();
+          rel.Id = objectA;
+          rel.Id2 = relationship;
+          
+          RowT inserted = 
+            tableAdapterWrapper.InsertNewRow(rel);
+
+          tableAdapterWrapper.UpdateRow(inserted);
+        }
+      }
+
+      //secondly check for deleted references
+      ICollection<Guid> deleted =
+        new List<Guid>();
+
+      foreach (Guid relationship in existing) {
+        if(!relationships.Contains(relationship)) {
+          deleted.Add(relationship);
+        }
+      }
+
+      foreach (Guid relationship in deleted) {
+        RowT toDelete =
+          FindRow(objectA, relationship);
+        if (toDelete != null) {
+          toDelete.Delete();
+          tableAdapterWrapper.UpdateRow(toDelete);
+        }
+      }
+    }
+
+    public IList<Guid> GetRelationships(Guid objectA) {
+      IList<Guid> result =
+        new List<Guid>();
+
+      IEnumerable<RowT> rows = 
+        tableAdapterWrapper.FindById(objectA);
+
+      foreach(RowT row in rows) {
+        result.Add((Guid)row[1]);
+      }
+
+      return result;
+    }
+
+    private RowT FindRow(Guid objectA, Guid objectB) {
+      IEnumerable<RowT> rows =
+       tableAdapterWrapper.FindById(objectA);
+
+      RowT found = null;
+
+      foreach (RowT row in rows) {
+        if (row[1].Equals(objectB)) {
+          found = row;
+          break;
+        }
+      }
+
+      return found;
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAccessADOHelperPlugin.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAccessADOHelperPlugin.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAccessADOHelperPlugin.cs	(revision 1529)
@@ -0,0 +1,33 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  [ClassInfo(Name = "HeuristicLab.DataAccess.ADOHelper-3.2")]
+  [PluginFile(Filename = "HeuristicLab.DataAccess.ADOHelper-3.2.dll", Filetype = PluginFileType.Assembly)]
+  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
+  public class DataAccessADOHelperPlugin : PluginBase {
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterBase.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterBase.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterBase.cs	(revision 1529)
@@ -0,0 +1,294 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Data;
+using System.Collections.Generic;
+using System.Text;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.DataAccess.Interfaces;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public abstract class DataAdapterBase<AdapterT, ObjT, RowT>
+    where AdapterT : new()
+    where RowT : System.Data.DataRow
+    where ObjT : IPersistableObject, new() {
+
+    private ISession session;
+
+    private IDataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter;
+
+    protected DataAdapterBase(
+      IDataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter) {
+      this.dataAdapter = dataAdapter;
+    }
+
+    protected AdapterT Adapter {
+      get {
+        return dataAdapter.TransactionalAdapter;
+      }
+    }
+
+    protected IDataAdapterWrapper<AdapterT, ObjT, RowT> DataAdapterWrapper {
+      get {
+        return dataAdapter;
+      }
+    }
+
+    public ISession Session {
+      get {
+        return this.session;
+      }
+
+      set {
+        if (!(value is Session))
+          throw new Exception("Can only bind to ADO session");
+
+        this.session = value;
+        this.dataAdapter.Session = value as Session;
+      }
+    }
+
+    public object InnerAdapter {
+      get {
+        return this.Adapter;
+      }
+    }
+
+    #region Abstract methods
+    protected abstract RowT ConvertObj(ObjT obj, RowT row);
+
+    protected abstract ObjT ConvertRow(RowT row, ObjT obj);
+    #endregion
+
+    protected delegate IEnumerable<RowT> Selector();
+
+    protected ObjT Convert(RowT row, ObjT obj) {
+      try {
+        obj = ConvertRow(row, obj);
+        return obj;
+      }
+      catch (DeletedRowInaccessibleException) {
+        return default(ObjT);
+      }
+      catch (RowNotInTableException) {
+        return default(ObjT);
+      }
+    }
+
+    protected RowT FindSingleRow(Selector selector) {
+      RowT row = default(RowT);
+
+      IEnumerable<RowT> found =
+        selector();
+
+      if (found.Count<RowT>() == 1)
+        row = found.First<RowT>();
+
+      return row;
+    }
+
+    protected ObjT FindSingle(Selector selector) {
+      ITransaction trans =
+       session.GetCurrentTransaction();
+      bool transactionExists = trans != null;
+      if (!transactionExists) {
+        trans = session.BeginTransaction();
+      }
+
+      try {
+        RowT row = FindSingleRow(selector);
+
+        ObjT result;
+        if (row != null) {
+          ObjT obj = new ObjT();
+          obj = Convert(row, obj);
+
+          result = obj;
+        } else {
+          result = default(ObjT);
+        }
+
+        return result;
+      }
+      finally {
+        if (!transactionExists && trans != null) {
+          trans.Commit();
+        }
+      }
+    }
+
+    protected ICollection<ObjT> FindMultiple(Selector selector) {
+      ITransaction trans =
+       session.GetCurrentTransaction();
+      bool transactionExists = trans != null;
+      if (!transactionExists) {
+        trans = session.BeginTransaction();
+      }
+
+      try {
+        IEnumerable<RowT> found =
+          selector();
+
+        IList<ObjT> result =
+          new List<ObjT>();
+
+        foreach (RowT row in found) {
+          ObjT obj = new ObjT();
+          obj = Convert(row, obj);
+          if (obj != null)
+            result.Add(obj);
+        }
+
+        return result;
+      }
+      finally {
+        if (!transactionExists && trans != null) {
+          trans.Commit();
+        }
+      }     
+    }
+
+    protected virtual RowT GetRowById(Guid id) {
+      return FindSingleRow(
+        delegate() {
+          return dataAdapter.FindById(id);
+        });
+    }
+
+    protected virtual void doUpdate(ObjT obj) {
+      if (obj != null) {
+        RowT row = null;
+
+        if (obj.Id != Guid.Empty) {
+          row = GetRowById(obj.Id);
+        } else {
+          obj.Id = Guid.NewGuid();
+        }
+
+        if (row == null) {
+          row = dataAdapter.InsertNewRow(obj);
+        }
+
+        ConvertObj(obj, row);
+        dataAdapter.UpdateRow(row);
+      }
+    }
+
+    public void Update(ObjT obj) {
+      ITransaction trans =
+        session.GetCurrentTransaction();
+      bool transactionExists = trans != null;
+      if (!transactionExists) {
+        trans = session.BeginTransaction();
+      }
+
+      try {
+        doUpdate(obj);
+      }
+      catch (DBConcurrencyException ex) {
+        DataRow row = ex.Row;
+
+        RowT current = GetRowById(obj.Id);
+        if (current != null) {
+          //find out changes
+          for (int i = 0; i < row.ItemArray.Length; i++) {            
+            if (!row[i, DataRowVersion.Current].Equals(
+                 row[i, DataRowVersion.Original])) {
+              current[i] = row[i];
+            }
+          }
+
+          ConvertRow(current, obj);
+          //try updating again
+          Update(obj);
+        }
+        //otherwise: row was deleted in the meantime - nothing to do
+      }
+      finally {
+        if (!transactionExists && trans != null) {
+          trans.Commit();
+        }
+      }
+    }
+
+    public virtual ObjT GetById(Guid id) {
+      return FindSingle(delegate() {
+        return dataAdapter.FindById(id);
+      });
+    }
+
+    public virtual ICollection<ObjT> GetAll() {
+      return new List<ObjT>(
+        FindMultiple(
+          new Selector(dataAdapter.FindAll)));
+    }
+
+    protected virtual bool doDelete(ObjT obj) {
+      bool success = false;
+
+      if (obj != null) {
+        RowT row =
+          GetRowById(obj.Id);
+
+        if (row != null) {
+          row.Delete();
+          dataAdapter.UpdateRow(row);
+
+          success = true;
+        }
+      }
+
+      return success;
+    }
+
+    public bool Delete(ObjT obj) {
+      ITransaction trans =
+        session.GetCurrentTransaction();
+      bool transactionExists = trans != null;
+      if (!transactionExists) {
+        trans = session.BeginTransaction();
+      }
+
+      try {
+        return doDelete(obj);
+      }
+      catch (DBConcurrencyException) {
+        RowT current = GetRowById(obj.Id);
+        if (current != null) {
+          ConvertRow(current, obj);
+          //try deleting again
+          return Delete(obj);
+        } else {
+          //row has already been deleted
+          return false;
+        }
+      }
+      finally {
+        if (!transactionExists && trans != null) {
+          trans.Commit();
+        }
+      }  
+    }
+  }
+}
+
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterWrapperBase.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterWrapperBase.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/DataAdapterWrapperBase.cs	(revision 1529)
@@ -0,0 +1,80 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+using System.Data.Common;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public abstract class DataAdapterWrapperBase<AdapterT, ObjT, RowT>:
+    IDataAdapterWrapper<AdapterT, ObjT, RowT>
+    where AdapterT : new()
+    where ObjT : IPersistableObject, new()
+    where RowT : System.Data.DataRow {
+    protected AdapterT adapter =
+      new AdapterT();
+
+    private ISession session;
+    
+    #region IDataAdapterWrapper<AdapterT,ObjT,RowT> Members
+
+    public AdapterT TransactionalAdapter {
+      get {
+        if (session == null)
+          throw new Exception("No session set!");
+
+        ITransaction trans =
+          session.GetCurrentTransaction();
+        if (trans != null)
+          SetTransaction(trans.InnerTransaction as DbTransaction);
+        else
+          SetTransaction(null);
+
+        return this.adapter; 
+      }
+    }
+
+    public Session Session {
+      set { 
+        this.session = value;
+
+        SetConnection(value.Connection); 
+      }
+    }
+
+    public abstract void UpdateRow(RowT row);
+
+    public abstract RowT InsertNewRow(ObjT obj);
+
+    public abstract IEnumerable<RowT> FindById(Guid id);
+
+    public abstract IEnumerable<RowT> FindAll();
+
+    protected abstract void SetConnection(DbConnection connection);
+
+    protected abstract void SetTransaction(DbTransaction transaction);
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/HeuristicLab.DataAccess.ADOHelper.csproj
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/HeuristicLab.DataAccess.ADOHelper.csproj	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/HeuristicLab.DataAccess.ADOHelper.csproj	(revision 1529)
@@ -0,0 +1,125 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{5CDACE54-5FB2-4344-A21C-963F63CB7C2B}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>HeuristicLab.DataAccess.ADOHelper</RootNamespace>
+    <AssemblyName>HeuristicLab.DataAccess.ADOHelper-3.2</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <StartupObject>
+    </StartupObject>
+    <SignAssembly>true</SignAssembly>
+    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+  <ItemGroup>
+    <None Include="HeuristicLab.snk" />
+    <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="DataAccessADOHelperPlugin.cs" />
+    <Compile Include="DataAdapterBase.cs" />
+    <Compile Include="DataAdapterWrapperBase.cs" />
+    <Compile Include="IDataAdapterWrapper.cs" />
+    <Compile Include="BinaryRelation.cs" />
+    <Compile Include="BinaryRelationHelper.cs" />
+    <Compile Include="Session.cs" />
+    <Compile Include="SessionFactory.cs" />
+    <Compile Include="Transaction.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.DataAccess\HeuristicLab.DataAccess.csproj">
+      <Project>{9076697B-C151-46CD-95BC-1D059492B478}</Project>
+      <Name>HeuristicLab.DataAccess</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
+      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
+      <Name>HeuristicLab.PluginInfrastructure</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.XML" />
+  </ItemGroup>
+  <PropertyGroup>
+    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd</PreBuildEvent>
+  </PropertyGroup>
+</Project>
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/IDataAdapterWrapper.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/IDataAdapterWrapper.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/IDataAdapterWrapper.cs	(revision 1529)
@@ -0,0 +1,46 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+using System.Data.Common;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public interface IDataAdapterWrapper<AdapterT, ObjT, RowT>
+   where AdapterT : new()
+   where ObjT : IPersistableObject, new()
+   where RowT : System.Data.DataRow {
+    void UpdateRow(RowT row);
+
+    RowT InsertNewRow(ObjT obj);
+
+    IEnumerable<RowT> FindById(Guid id);
+
+    IEnumerable<RowT> FindAll();
+
+    AdapterT TransactionalAdapter { get; }
+
+    Session Session { set; }
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Properties/AssemblyInfo.frame
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Properties/AssemblyInfo.frame	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Properties/AssemblyInfo.frame	(revision 1529)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.DataAccess.ADOHelper")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(c) 2002-2008 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("99D769C4-55B0-4f2a-81B4-11763DCD7A03")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("3.2.0.$WCREV$")]
+[assembly: AssemblyFileVersion("3.2.0.$WCREV$")]
+[assembly: AssemblyBuildDate("$WCNOW$")]
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Session.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Session.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Session.cs	(revision 1529)
@@ -0,0 +1,144 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+using HeuristicLab.PluginInfrastructure;
+using System.Data.Common;
+using System.Threading;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public class Session: ISession {
+    private static DiscoveryService discoveryService =
+      new DiscoveryService();
+
+    private SessionFactory factory;
+
+    private Transaction transaction;
+
+    private DbConnection connection;
+
+    private Thread ownerThread;
+
+    private IDictionary<Guid, object> adapters =
+      new Dictionary<Guid, object>();
+
+    public Session(SessionFactory factory) {
+      this.factory = factory;
+      this.ownerThread = Thread.CurrentThread;
+    }
+
+    public void CheckThread() {
+      if (!Thread.CurrentThread.Equals(ownerThread)) {
+        throw new Exception("Session is owned by another thread");
+      }
+    }
+
+    public DbConnection Connection {
+      get {
+        if (connection == null) {
+          connection = factory.CreateConnection();
+        }
+
+        return connection;
+      }
+    }
+
+    public void DetachTrasaction() {
+      this.transaction = null;
+    }
+
+    #region ISession Members
+    public ITransaction BeginTransaction() {
+      CheckThread();
+
+      if (transaction == null) {
+         transaction = new Transaction(this);
+         transaction.Connection = Connection;
+      }
+
+      return transaction;
+    }
+
+    public ITransaction GetCurrentTransaction() {
+      CheckThread();
+
+      return transaction;
+    }
+
+    public IDataAdapter<ObjT> GetDataAdapter<ObjT>()
+      where ObjT : IPersistableObject {
+      CheckThread();
+
+      Guid adapterId = typeof(IDataAdapter<ObjT>).GUID;
+
+      if (!adapters.ContainsKey(adapterId)) {
+        IDataAdapter<ObjT> adapter =
+          discoveryService.GetInstances<IDataAdapter<ObjT>>()[0];
+
+        adapter.Session = this;
+
+        adapters.Add(adapterId, adapter);
+      }
+
+      return adapters[adapterId] as IDataAdapter<ObjT>;
+    }
+
+    public T GetDataAdapter<ObjT, T>()
+      where ObjT : IPersistableObject
+      where T : class, IDataAdapter<ObjT>
+    {
+      CheckThread();
+
+      Guid adapterId = typeof(T).GUID;
+
+      if (!adapters.ContainsKey(adapterId)) {
+        T adapter =
+          discoveryService.GetInstances<T>()[0];
+
+        adapter.Session = this;
+
+        adapters.Add(adapterId, adapter);
+      }
+
+      return adapters[adapterId] as T;
+    }
+
+    public void EndSession() {
+      CheckThread();
+
+      if (transaction != null) {
+        transaction.Rollback();
+        transaction = null;
+      }
+      if (connection.State == System.Data.ConnectionState.Open) {
+        connection.Close();
+        connection = null;
+      }
+      factory.EndSession(this);
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/SessionFactory.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/SessionFactory.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/SessionFactory.cs	(revision 1529)
@@ -0,0 +1,111 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+using System.Threading;
+using System.Timers;
+using System.Data.Common;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  public class SessionFactory: ISessionFactory {
+    private IDictionary<Thread, ISession> sessions =
+      new Dictionary<Thread, ISession>();
+
+    public Type DbConnectionType { get;  set; }
+    public String DbConnectionString { get;  set; }
+
+    public SessionFactory() {
+      System.Timers.Timer timer =
+        new System.Timers.Timer();
+
+      TimeSpan interval =
+        new TimeSpan(0, 1, 0);
+
+      timer.Interval = interval.TotalMilliseconds;
+      timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
+      timer.Start();
+    }
+
+    void timer_Elapsed(object sender, ElapsedEventArgs e) {
+      lock (this) {
+        ICollection<Thread> toBeRemoved =
+          new List<Thread>();
+
+        foreach (Thread t in sessions.Keys) {
+          if (t.ThreadState == ThreadState.Stopped) {
+            toBeRemoved.Add(t);
+          }
+        }
+
+        foreach (Thread t in toBeRemoved) {
+          sessions.Remove(t);
+        }
+      }
+    }
+
+    public DbConnection CreateConnection() {
+      DbConnection conn = 
+        Activator.CreateInstance(DbConnectionType) as DbConnection;
+
+      conn.ConnectionString = DbConnectionString;
+
+      return conn;
+    }
+
+    #region ISessionFactory Members
+
+    public ISession GetSessionForCurrentThread() {
+      lock (this) {
+        Thread current = Thread.CurrentThread;
+
+        if (!sessions.ContainsKey(current)) {
+          sessions[current] =
+            new Session(this);
+        }
+
+        return sessions[current];
+      }
+    }
+
+    public void EndSession(ISession session) {
+      lock (this) {
+        ICollection<Thread> toBeRemoved =
+          new List<Thread>();
+
+        foreach(Thread t in sessions.Keys) {
+          if(sessions[t].Equals(session)) {
+            toBeRemoved.Add(t);
+          }
+        }
+
+        foreach (Thread t in toBeRemoved) {
+          sessions.Remove(t);
+        }
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Transaction.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Transaction.cs	(revision 1529)
+++ trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Transaction.cs	(revision 1529)
@@ -0,0 +1,101 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataAccess.Interfaces;
+using System.Data;
+using System.Data.Common;
+
+namespace HeuristicLab.DataAccess.ADOHelper {
+  class Transaction: ITransaction {
+    private DbTransaction transaction;
+
+    private Session session;
+
+    public Transaction(Session session) {
+      this.session = session;
+    }
+
+    public DbConnection Connection {
+      set {
+        if (value != null &&
+          (transaction == null ||
+           !(transaction.Connection != null &&
+             transaction.Connection.Equals(value)))) {
+          if (value.State != System.Data.ConnectionState.Open)
+            value.Open();
+
+          transaction = value.BeginTransaction(IsolationLevel.ReadCommitted);
+        }
+      }
+    }
+
+    #region ITransaction Members
+    public void Commit() {
+      this.session.CheckThread();
+
+      if (transaction != null) {
+        DbConnection conn =
+          transaction.Connection;
+
+        transaction.Commit();
+
+        transaction = null;
+        session.DetachTrasaction();
+
+        if (conn != null && 
+            conn.State == System.Data.ConnectionState.Open)
+          conn.Close();
+      }
+    }
+
+    public void Rollback() {
+      this.session.CheckThread();
+
+      if (transaction != null) {
+        DbConnection conn =
+            transaction.Connection;
+
+        transaction.Rollback();
+
+        transaction = null;
+        session.DetachTrasaction();
+
+        if (conn != null &&
+            conn.State == System.Data.ConnectionState.Open)
+          conn.Close();
+      }
+    }
+
+    public object InnerTransaction {
+      get {
+        this.session.CheckThread();
+
+        return transaction;
+      }
+    }
+
+    #endregion
+  }
+}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/BinaryRelation.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/BinaryRelation.cs	(revision 1528)
+++ 	(revision )
@@ -1,11 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public class BinaryRelation: PersistableObject {
-    public Guid Id2 { get; set; }
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/BinaryRelationHelper.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/BinaryRelationHelper.cs	(revision 1528)
+++ 	(revision )
@@ -1,93 +1,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public class BinaryRelationHelper<AdapterT, RowT>
-    where AdapterT : new()
-    where RowT : System.Data.DataRow
-    {
-    IDataAdapterWrapper<AdapterT, BinaryRelation, RowT> tableAdapterWrapper;
-    
-    public BinaryRelationHelper(
-      IDataAdapterWrapper<AdapterT, BinaryRelation, RowT> tableAdapterWrapper) {
-      this.tableAdapterWrapper = tableAdapterWrapper;
-    }
-
-    public Session Session {
-      set {
-        tableAdapterWrapper.Session = value;
-      }
-    }
-
-    public void UpdateRelationships(Guid objectA, IList<Guid> relationships) {
-      //firstly check for created references
-      IList<Guid> existing =
-        this.GetRelationships(objectA);
-
-      foreach (Guid relationship in relationships) {
-        if (!existing.Contains(relationship)) {
-          BinaryRelation rel = 
-            new BinaryRelation();
-          rel.Id = objectA;
-          rel.Id2 = relationship;
-          
-          RowT inserted = 
-            tableAdapterWrapper.InsertNewRow(rel);
-
-          tableAdapterWrapper.UpdateRow(inserted);
-        }
-      }
-
-      //secondly check for deleted references
-      ICollection<Guid> deleted =
-        new List<Guid>();
-
-      foreach (Guid relationship in existing) {
-        if(!relationships.Contains(relationship)) {
-          deleted.Add(relationship);
-        }
-      }
-
-      foreach (Guid relationship in deleted) {
-        RowT toDelete =
-          FindRow(objectA, relationship);
-        if (toDelete != null) {
-          toDelete.Delete();
-          tableAdapterWrapper.UpdateRow(toDelete);
-        }
-      }
-    }
-
-    public IList<Guid> GetRelationships(Guid objectA) {
-      IList<Guid> result =
-        new List<Guid>();
-
-      IEnumerable<RowT> rows = 
-        tableAdapterWrapper.FindById(objectA);
-
-      foreach(RowT row in rows) {
-        result.Add((Guid)row[1]);
-      }
-
-      return result;
-    }
-
-    private RowT FindRow(Guid objectA, Guid objectB) {
-      IEnumerable<RowT> rows =
-       tableAdapterWrapper.FindById(objectA);
-
-      RowT found = null;
-
-      foreach (RowT row in rows) {
-        if (row[1].Equals(objectB)) {
-          found = row;
-          break;
-        }
-      }
-
-      return found;
-    }
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAccessADOHelperPlugin.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAccessADOHelperPlugin.cs	(revision 1528)
+++ 	(revision )
@@ -1,33 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  [ClassInfo(Name = "HeuristicLab.DataAccess.ADOHelper-3.2")]
-  [PluginFile(Filename = "HeuristicLab.DataAccess.ADOHelper-3.2.dll", Filetype = PluginFileType.Assembly)]
-  [Dependency(Dependency = "HeuristicLab.Core-3.2")]
-  public class DataAccessADOHelperPlugin : PluginBase {
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAdapterBase.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAdapterBase.cs	(revision 1528)
+++ 	(revision )
@@ -1,294 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Data;
-using System.Collections.Generic;
-using System.Text;
-using System.Linq;
-using System.Threading;
-using HeuristicLab.DataAccess.Interfaces;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public abstract class DataAdapterBase<AdapterT, ObjT, RowT>
-    where AdapterT : new()
-    where RowT : System.Data.DataRow
-    where ObjT : IPersistableObject, new() {
-
-    private ISession session;
-
-    private IDataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter;
-
-    protected DataAdapterBase(
-      IDataAdapterWrapper<AdapterT, ObjT, RowT> dataAdapter) {
-      this.dataAdapter = dataAdapter;
-    }
-
-    protected AdapterT Adapter {
-      get {
-        return dataAdapter.TransactionalAdapter;
-      }
-    }
-
-    protected IDataAdapterWrapper<AdapterT, ObjT, RowT> DataAdapterWrapper {
-      get {
-        return dataAdapter;
-      }
-    }
-
-    public ISession Session {
-      get {
-        return this.session;
-      }
-
-      set {
-        if (!(value is Session))
-          throw new Exception("Can only bind to ADO session");
-
-        this.session = value;
-        this.dataAdapter.Session = value as Session;
-      }
-    }
-
-    public object InnerAdapter {
-      get {
-        return this.Adapter;
-      }
-    }
-
-    #region Abstract methods
-    protected abstract RowT ConvertObj(ObjT obj, RowT row);
-
-    protected abstract ObjT ConvertRow(RowT row, ObjT obj);
-    #endregion
-
-    protected delegate IEnumerable<RowT> Selector();
-
-    protected ObjT Convert(RowT row, ObjT obj) {
-      try {
-        obj = ConvertRow(row, obj);
-        return obj;
-      }
-      catch (DeletedRowInaccessibleException) {
-        return default(ObjT);
-      }
-      catch (RowNotInTableException) {
-        return default(ObjT);
-      }
-    }
-
-    protected RowT FindSingleRow(Selector selector) {
-      RowT row = default(RowT);
-
-      IEnumerable<RowT> found =
-        selector();
-
-      if (found.Count<RowT>() == 1)
-        row = found.First<RowT>();
-
-      return row;
-    }
-
-    protected ObjT FindSingle(Selector selector) {
-      ITransaction trans =
-       session.GetCurrentTransaction();
-      bool transactionExists = trans != null;
-      if (!transactionExists) {
-        trans = session.BeginTransaction();
-      }
-
-      try {
-        RowT row = FindSingleRow(selector);
-
-        ObjT result;
-        if (row != null) {
-          ObjT obj = new ObjT();
-          obj = Convert(row, obj);
-
-          result = obj;
-        } else {
-          result = default(ObjT);
-        }
-
-        return result;
-      }
-      finally {
-        if (!transactionExists && trans != null) {
-          trans.Commit();
-        }
-      }
-    }
-
-    protected ICollection<ObjT> FindMultiple(Selector selector) {
-      ITransaction trans =
-       session.GetCurrentTransaction();
-      bool transactionExists = trans != null;
-      if (!transactionExists) {
-        trans = session.BeginTransaction();
-      }
-
-      try {
-        IEnumerable<RowT> found =
-          selector();
-
-        IList<ObjT> result =
-          new List<ObjT>();
-
-        foreach (RowT row in found) {
-          ObjT obj = new ObjT();
-          obj = Convert(row, obj);
-          if (obj != null)
-            result.Add(obj);
-        }
-
-        return result;
-      }
-      finally {
-        if (!transactionExists && trans != null) {
-          trans.Commit();
-        }
-      }     
-    }
-
-    protected virtual RowT GetRowById(Guid id) {
-      return FindSingleRow(
-        delegate() {
-          return dataAdapter.FindById(id);
-        });
-    }
-
-    protected virtual void doUpdate(ObjT obj) {
-      if (obj != null) {
-        RowT row = null;
-
-        if (obj.Id != Guid.Empty) {
-          row = GetRowById(obj.Id);
-        } else {
-          obj.Id = Guid.NewGuid();
-        }
-
-        if (row == null) {
-          row = dataAdapter.InsertNewRow(obj);
-        }
-
-        ConvertObj(obj, row);
-        dataAdapter.UpdateRow(row);
-      }
-    }
-
-    public void Update(ObjT obj) {
-      ITransaction trans =
-        session.GetCurrentTransaction();
-      bool transactionExists = trans != null;
-      if (!transactionExists) {
-        trans = session.BeginTransaction();
-      }
-
-      try {
-        doUpdate(obj);
-      }
-      catch (DBConcurrencyException ex) {
-        DataRow row = ex.Row;
-
-        RowT current = GetRowById(obj.Id);
-        if (current != null) {
-          //find out changes
-          for (int i = 0; i < row.ItemArray.Length; i++) {            
-            if (!row[i, DataRowVersion.Current].Equals(
-                 row[i, DataRowVersion.Original])) {
-              current[i] = row[i];
-            }
-          }
-
-          ConvertRow(current, obj);
-          //try updating again
-          Update(obj);
-        }
-        //otherwise: row was deleted in the meantime - nothing to do
-      }
-      finally {
-        if (!transactionExists && trans != null) {
-          trans.Commit();
-        }
-      }
-    }
-
-    public virtual ObjT GetById(Guid id) {
-      return FindSingle(delegate() {
-        return dataAdapter.FindById(id);
-      });
-    }
-
-    public virtual ICollection<ObjT> GetAll() {
-      return new List<ObjT>(
-        FindMultiple(
-          new Selector(dataAdapter.FindAll)));
-    }
-
-    protected virtual bool doDelete(ObjT obj) {
-      bool success = false;
-
-      if (obj != null) {
-        RowT row =
-          GetRowById(obj.Id);
-
-        if (row != null) {
-          row.Delete();
-          dataAdapter.UpdateRow(row);
-
-          success = true;
-        }
-      }
-
-      return success;
-    }
-
-    public bool Delete(ObjT obj) {
-      ITransaction trans =
-        session.GetCurrentTransaction();
-      bool transactionExists = trans != null;
-      if (!transactionExists) {
-        trans = session.BeginTransaction();
-      }
-
-      try {
-        return doDelete(obj);
-      }
-      catch (DBConcurrencyException) {
-        RowT current = GetRowById(obj.Id);
-        if (current != null) {
-          ConvertRow(current, obj);
-          //try deleting again
-          return Delete(obj);
-        } else {
-          //row has already been deleted
-          return false;
-        }
-      }
-      finally {
-        if (!transactionExists && trans != null) {
-          trans.Commit();
-        }
-      }  
-    }
-  }
-}
-
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAdapterWrapperBase.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/DataAdapterWrapperBase.cs	(revision 1528)
+++ 	(revision )
@@ -1,80 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-using System.Data.Common;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public abstract class DataAdapterWrapperBase<AdapterT, ObjT, RowT>:
-    IDataAdapterWrapper<AdapterT, ObjT, RowT>
-    where AdapterT : new()
-    where ObjT : IPersistableObject, new()
-    where RowT : System.Data.DataRow {
-    protected AdapterT adapter =
-      new AdapterT();
-
-    private ISession session;
-    
-    #region IDataAdapterWrapper<AdapterT,ObjT,RowT> Members
-
-    public AdapterT TransactionalAdapter {
-      get {
-        if (session == null)
-          throw new Exception("No session set!");
-
-        ITransaction trans =
-          session.GetCurrentTransaction();
-        if (trans != null)
-          SetTransaction(trans.InnerTransaction as DbTransaction);
-        else
-          SetTransaction(null);
-
-        return this.adapter; 
-      }
-    }
-
-    public Session Session {
-      set { 
-        this.session = value;
-
-        SetConnection(value.Connection); 
-      }
-    }
-
-    public abstract void UpdateRow(RowT row);
-
-    public abstract RowT InsertNewRow(ObjT obj);
-
-    public abstract IEnumerable<RowT> FindById(Guid id);
-
-    public abstract IEnumerable<RowT> FindAll();
-
-    protected abstract void SetConnection(DbConnection connection);
-
-    protected abstract void SetTransaction(DbTransaction transaction);
-
-    #endregion
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/HeuristicLab.DataAccess.ADOHelper.csproj
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/HeuristicLab.DataAccess.ADOHelper.csproj	(revision 1528)
+++ 	(revision )
@@ -1,125 +1,0 @@
-﻿<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{5CDACE54-5FB2-4344-A21C-963F63CB7C2B}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>HeuristicLab.DataAccess.ADOHelper</RootNamespace>
-    <AssemblyName>HeuristicLab.DataAccess.ADOHelper-3.2</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <StartupObject>
-    </StartupObject>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <DebugSymbols>true</DebugSymbols>
-    <OutputPath>bin\x86\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <DebugType>full</DebugType>
-    <PlatformTarget>x86</PlatformTarget>
-    <ErrorReport>prompt</ErrorReport>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <OutputPath>bin\x86\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <Optimize>true</Optimize>
-    <DebugType>pdbonly</DebugType>
-    <PlatformTarget>x86</PlatformTarget>
-    <ErrorReport>prompt</ErrorReport>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
-    <DebugSymbols>true</DebugSymbols>
-    <OutputPath>bin\x64\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <DebugType>full</DebugType>
-    <PlatformTarget>x64</PlatformTarget>
-    <ErrorReport>prompt</ErrorReport>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
-    <OutputPath>bin\x64\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <Optimize>true</Optimize>
-    <DebugType>pdbonly</DebugType>
-    <PlatformTarget>x64</PlatformTarget>
-    <ErrorReport>prompt</ErrorReport>
-  </PropertyGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ItemGroup>
-    <None Include="HeuristicLab.snk" />
-    <None Include="Properties\AssemblyInfo.frame" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="DataAccessADOHelperPlugin.cs" />
-    <Compile Include="DataAdapterBase.cs" />
-    <Compile Include="DataAdapterWrapperBase.cs" />
-    <Compile Include="IDataAdapterWrapper.cs" />
-    <Compile Include="BinaryRelation.cs" />
-    <Compile Include="BinaryRelationHelper.cs" />
-    <Compile Include="Session.cs" />
-    <Compile Include="SessionFactory.cs" />
-    <Compile Include="Transaction.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\HeuristicLab.DataAccess\HeuristicLab.DataAccess.csproj">
-      <Project>{9076697B-C151-46CD-95BC-1D059492B478}</Project>
-      <Name>HeuristicLab.DataAccess</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
-      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
-      <Name>HeuristicLab.PluginInfrastructure</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data" />
-    <Reference Include="System.Data.DataSetExtensions">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.Data.Linq">
-      <RequiredTargetFramework>3.5</RequiredTargetFramework>
-    </Reference>
-    <Reference Include="System.XML" />
-  </ItemGroup>
-  <PropertyGroup>
-    <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
-set ProjectDir=$(ProjectDir)
-set SolutionDir=$(SolutionDir)
-set Outdir=$(Outdir)
-
-call PreBuildEvent.cmd</PreBuildEvent>
-  </PropertyGroup>
-</Project>
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/IDataAdapterWrapper.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/IDataAdapterWrapper.cs	(revision 1528)
+++ 	(revision )
@@ -1,46 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-using System.Data.Common;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public interface IDataAdapterWrapper<AdapterT, ObjT, RowT>
-   where AdapterT : new()
-   where ObjT : IPersistableObject, new()
-   where RowT : System.Data.DataRow {
-    void UpdateRow(RowT row);
-
-    RowT InsertNewRow(ObjT obj);
-
-    IEnumerable<RowT> FindById(Guid id);
-
-    IEnumerable<RowT> FindAll();
-
-    AdapterT TransactionalAdapter { get; }
-
-    Session Session { set; }
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/Session.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/Session.cs	(revision 1528)
+++ 	(revision )
@@ -1,144 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-using HeuristicLab.PluginInfrastructure;
-using System.Data.Common;
-using System.Threading;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public class Session: ISession {
-    private static DiscoveryService discoveryService =
-      new DiscoveryService();
-
-    private SessionFactory factory;
-
-    private Transaction transaction;
-
-    private DbConnection connection;
-
-    private Thread ownerThread;
-
-    private IDictionary<Guid, object> adapters =
-      new Dictionary<Guid, object>();
-
-    public Session(SessionFactory factory) {
-      this.factory = factory;
-      this.ownerThread = Thread.CurrentThread;
-    }
-
-    public void CheckThread() {
-      if (!Thread.CurrentThread.Equals(ownerThread)) {
-        throw new Exception("Session is owned by another thread");
-      }
-    }
-
-    public DbConnection Connection {
-      get {
-        if (connection == null) {
-          connection = factory.CreateConnection();
-        }
-
-        return connection;
-      }
-    }
-
-    public void DetachTrasaction() {
-      this.transaction = null;
-    }
-
-    #region ISession Members
-    public ITransaction BeginTransaction() {
-      CheckThread();
-
-      if (transaction == null) {
-         transaction = new Transaction(this);
-         transaction.Connection = Connection;
-      }
-
-      return transaction;
-    }
-
-    public ITransaction GetCurrentTransaction() {
-      CheckThread();
-
-      return transaction;
-    }
-
-    public IDataAdapter<ObjT> GetDataAdapter<ObjT>()
-      where ObjT : IPersistableObject {
-      CheckThread();
-
-      Guid adapterId = typeof(IDataAdapter<ObjT>).GUID;
-
-      if (!adapters.ContainsKey(adapterId)) {
-        IDataAdapter<ObjT> adapter =
-          discoveryService.GetInstances<IDataAdapter<ObjT>>()[0];
-
-        adapter.Session = this;
-
-        adapters.Add(adapterId, adapter);
-      }
-
-      return adapters[adapterId] as IDataAdapter<ObjT>;
-    }
-
-    public T GetDataAdapter<ObjT, T>()
-      where ObjT : IPersistableObject
-      where T : class, IDataAdapter<ObjT>
-    {
-      CheckThread();
-
-      Guid adapterId = typeof(T).GUID;
-
-      if (!adapters.ContainsKey(adapterId)) {
-        T adapter =
-          discoveryService.GetInstances<T>()[0];
-
-        adapter.Session = this;
-
-        adapters.Add(adapterId, adapter);
-      }
-
-      return adapters[adapterId] as T;
-    }
-
-    public void EndSession() {
-      CheckThread();
-
-      if (transaction != null) {
-        transaction.Rollback();
-        transaction = null;
-      }
-      if (connection.State == System.Data.ConnectionState.Open) {
-        connection.Close();
-        connection = null;
-      }
-      factory.EndSession(this);
-    }
-
-    #endregion
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/SessionFactory.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/SessionFactory.cs	(revision 1528)
+++ 	(revision )
@@ -1,111 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-using System.Threading;
-using System.Timers;
-using System.Data.Common;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  public class SessionFactory: ISessionFactory {
-    private IDictionary<Thread, ISession> sessions =
-      new Dictionary<Thread, ISession>();
-
-    public Type DbConnectionType { get;  set; }
-    public String DbConnectionString { get;  set; }
-
-    public SessionFactory() {
-      System.Timers.Timer timer =
-        new System.Timers.Timer();
-
-      TimeSpan interval =
-        new TimeSpan(0, 1, 0);
-
-      timer.Interval = interval.TotalMilliseconds;
-      timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
-      timer.Start();
-    }
-
-    void timer_Elapsed(object sender, ElapsedEventArgs e) {
-      lock (this) {
-        ICollection<Thread> toBeRemoved =
-          new List<Thread>();
-
-        foreach (Thread t in sessions.Keys) {
-          if (t.ThreadState == ThreadState.Stopped) {
-            toBeRemoved.Add(t);
-          }
-        }
-
-        foreach (Thread t in toBeRemoved) {
-          sessions.Remove(t);
-        }
-      }
-    }
-
-    public DbConnection CreateConnection() {
-      DbConnection conn = 
-        Activator.CreateInstance(DbConnectionType) as DbConnection;
-
-      conn.ConnectionString = DbConnectionString;
-
-      return conn;
-    }
-
-    #region ISessionFactory Members
-
-    public ISession GetSessionForCurrentThread() {
-      lock (this) {
-        Thread current = Thread.CurrentThread;
-
-        if (!sessions.ContainsKey(current)) {
-          sessions[current] =
-            new Session(this);
-        }
-
-        return sessions[current];
-      }
-    }
-
-    public void EndSession(ISession session) {
-      lock (this) {
-        ICollection<Thread> toBeRemoved =
-          new List<Thread>();
-
-        foreach(Thread t in sessions.Keys) {
-          if(sessions[t].Equals(session)) {
-            toBeRemoved.Add(t);
-          }
-        }
-
-        foreach (Thread t in toBeRemoved) {
-          sessions.Remove(t);
-        }
-      }
-    }
-
-    #endregion
-  }
-}
Index: trunk/sources/HeuristicLab.DataAccess.ADOHelper/Transaction.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAccess.ADOHelper/Transaction.cs	(revision 1528)
+++ 	(revision )
@@ -1,101 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.DataAccess.Interfaces;
-using System.Data;
-using System.Data.Common;
-
-namespace HeuristicLab.DataAccess.ADOHelper {
-  class Transaction: ITransaction {
-    private DbTransaction transaction;
-
-    private Session session;
-
-    public Transaction(Session session) {
-      this.session = session;
-    }
-
-    public DbConnection Connection {
-      set {
-        if (value != null &&
-          (transaction == null ||
-           !(transaction.Connection != null &&
-             transaction.Connection.Equals(value)))) {
-          if (value.State != System.Data.ConnectionState.Open)
-            value.Open();
-
-          transaction = value.BeginTransaction(IsolationLevel.ReadCommitted);
-        }
-      }
-    }
-
-    #region ITransaction Members
-    public void Commit() {
-      this.session.CheckThread();
-
-      if (transaction != null) {
-        DbConnection conn =
-          transaction.Connection;
-
-        transaction.Commit();
-
-        transaction = null;
-        session.DetachTrasaction();
-
-        if (conn != null && 
-            conn.State == System.Data.ConnectionState.Open)
-          conn.Close();
-      }
-    }
-
-    public void Rollback() {
-      this.session.CheckThread();
-
-      if (transaction != null) {
-        DbConnection conn =
-            transaction.Connection;
-
-        transaction.Rollback();
-
-        transaction = null;
-        session.DetachTrasaction();
-
-        if (conn != null &&
-            conn.State == System.Data.ConnectionState.Open)
-          conn.Close();
-      }
-    }
-
-    public object InnerTransaction {
-      get {
-        this.session.CheckThread();
-
-        return transaction;
-      }
-    }
-
-    #endregion
-  }
-}
