Index: trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs	(revision 1125)
+++ trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs	(revision 1128)
@@ -30,18 +30,19 @@
 namespace HeuristicLab.Hive.Server.ADODataAccess {
   abstract class CachedDataAdapter<AdapterT, ObjT, RowT, CacheT> :
-    DataAdapterBase<AdapterT, ObjT, RowT>, 
+    DataAdapterBase<AdapterT, ObjT, RowT>,
     ICachedDataAdapter
-    where CacheT: System.Data.TypedTableBase<RowT>, new()
+    where CacheT : System.Data.TypedTableBase<RowT>, new()
     where AdapterT : new()
     where RowT : System.Data.DataRow
     where ObjT : IHiveObject, new() {
-    protected CacheT cache = 
+    protected CacheT cache =
       new CacheT();
+
+    protected IDictionary<long, DataTable> dataTable =
+      new Dictionary<long, DataTable>();
 
     protected ICollection<ICachedDataAdapter> parentAdapters =
       new List<ICachedDataAdapter>();
 
-    private DataTable temp = new DataTable();
-
     protected CachedDataAdapter() {
       FillCache();
@@ -51,5 +52,6 @@
     }
 
-    protected virtual RowT FindSingleRow(Selector dbSelector, 
+    [MethodImpl(MethodImplOptions.Synchronized)]
+    protected virtual RowT FindSingleRow(Selector dbSelector,
       Selector cacheSelector) {
       RowT row =
@@ -65,4 +67,5 @@
     }
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual IEnumerable<RowT> FindMultipleRows(Selector dbSelector,
         Selector cacheSelector) {
@@ -96,4 +99,5 @@
     }
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual ICollection<ObjT> FindMultiple(Selector dbSelector,
       Selector cacheSelector) {
@@ -124,4 +128,5 @@
     protected abstract bool PutInCache(ObjT obj);
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected abstract RowT FindCachedById(long id);
 
@@ -136,5 +141,5 @@
 
     [MethodImpl(MethodImplOptions.Synchronized)]
-    protected virtual void RemoveRowFromCache(RowT row) {      
+    protected virtual void RemoveRowFromCache(RowT row) {
       cache.Rows.Remove(row);
     }
@@ -143,13 +148,14 @@
       if (row == null)
         return false;
-     else
+      else
         return FindCachedById((long)row[row.Table.PrimaryKey[0]]) != null;
     }
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected override RowT GetRowById(long id) {
       RowT row =
         FindCachedById(id);
-      
-      if(row == null)
+
+      if (row == null)
         row = FindSingleRow(
           delegate() {
@@ -163,5 +169,5 @@
     public override void Update(ObjT obj) {
       if (obj != null) {
-        RowT row = 
+        RowT row =
           GetRowById(obj.Id);
 
@@ -182,9 +188,10 @@
         if (!IsCached(row))
           UpdateRow(row);
-        
+
         if (IsCached(row) &&
             !PutInCache(obj)) {
           //remove from cache
-          temp.ImportRow(row);
+          dataTable[obj.Id].ImportRow(row);
+          dataTable.Remove(obj.Id);
 
           UpdateRow(row);
@@ -195,4 +202,5 @@
           cache.ImportRow(row);
 
+          dataTable[obj.Id] = row.Table;
           row.Table.Rows.Remove(row);
         }
@@ -201,2 +209,3 @@
   }
 }
+
Index: trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs
===================================================================
--- trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs	(revision 1125)
+++ trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs	(revision 1128)
@@ -29,7 +29,7 @@
 namespace HeuristicLab.Hive.Server.ADODataAccess {
   abstract class DataAdapterBase<AdapterT, ObjT, RowT>
-    where AdapterT: new() 
-    where RowT: System.Data.DataRow
-    where ObjT: IHiveObject, new() {
+    where AdapterT : new()
+    where RowT : System.Data.DataRow
+    where ObjT : IHiveObject, new() {
     protected AdapterT adapter =
       new AdapterT();
@@ -46,6 +46,8 @@
     protected abstract void UpdateRow(RowT row);
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected abstract IEnumerable<RowT> FindById(long id);
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected abstract IEnumerable<RowT> FindAll();
     #endregion
@@ -53,4 +55,5 @@
     protected delegate IEnumerable<RowT> Selector();
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual RowT FindSingleRow(Selector selector) {
       RowT row = default(RowT);
@@ -78,4 +81,5 @@
     }
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual ICollection<ObjT> FindMultiple(Selector selector) {
       IEnumerable<RowT> found =
@@ -149,2 +153,3 @@
   }
 }
+
