Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs	(revision 1131)
@@ -36,15 +36,21 @@
     where RowT : System.Data.DataRow
     where ObjT : IHiveObject, new() {
-    protected CacheT cache =
+    protected static CacheT cache =
       new CacheT();
 
-    protected IDictionary<long, DataTable> dataTable =
-      new Dictionary<long, DataTable>();
+    private static bool cacheFilled = false;
+
+    protected DataTable dataTable =
+      new DataTable();
 
     protected ICollection<ICachedDataAdapter> parentAdapters =
       new List<ICachedDataAdapter>();
 
+    [MethodImpl(MethodImplOptions.Synchronized)]
     protected CachedDataAdapter() {
-      FillCache();
+      if (!cacheFilled) {
+        FillCache();
+        cacheFilled = true;
+      }
 
       ServiceLocator.GetTransactionManager().OnUpdate +=
@@ -52,5 +58,4 @@
     }
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual RowT FindSingleRow(Selector dbSelector,
       Selector cacheSelector) {
@@ -67,5 +72,4 @@
     }
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual IEnumerable<RowT> FindMultipleRows(Selector dbSelector,
         Selector cacheSelector) {
@@ -91,6 +95,6 @@
       if (row != null) {
         ObjT obj = new ObjT();
-        Convert(row, obj);
-
+        obj = Convert(row, obj);
+        
         return obj;
       } else {
@@ -99,5 +103,4 @@
     }
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual ICollection<ObjT> FindMultiple(Selector dbSelector,
       Selector cacheSelector) {
@@ -128,5 +131,4 @@
     protected abstract bool PutInCache(ObjT obj);
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected abstract RowT FindCachedById(long id);
 
@@ -152,5 +154,4 @@
     }
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected override RowT GetRowById(long id) {
       RowT row =
@@ -184,5 +185,5 @@
         obj.Id = (long)row[row.Table.PrimaryKey[0]];
 
-        Convert(obj, row);
+        ConvertObj(obj, row);
 
         if (!IsCached(row))
@@ -192,17 +193,14 @@
             !PutInCache(obj)) {
           //remove from cache
-          dataTable[obj.Id].ImportRow(row);
-          dataTable.Remove(obj.Id);
+          dataTable.ImportRow(row);
+          RemoveRowFromCache(row);
 
           UpdateRow(row);
-          RemoveRowFromCache(row);
         } else if (!IsCached(row) &&
           PutInCache(obj)) {
           //add to cache
           cache.ImportRow(row);
-
-          dataTable[obj.Id] = row.Table;
           row.Table.Rows.Remove(row);
-        }
+        } 
       }
     }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientAdapter.cs	(revision 1131)
@@ -92,5 +92,5 @@
 
     #region Overrides
-    protected override ClientInfo Convert(dsHiveServer.ClientRow row, 
+    protected override ClientInfo ConvertRow(dsHiveServer.ClientRow row, 
       ClientInfo client) {
       if(row != null && client != null) {      
@@ -138,5 +138,5 @@
     }
 
-    protected override dsHiveServer.ClientRow Convert(ClientInfo client,
+    protected override dsHiveServer.ClientRow ConvertObj(ClientInfo client,
       dsHiveServer.ClientRow row) {
       if (client != null && row != null) {      
@@ -162,5 +162,5 @@
 
     protected override void UpdateRow(dsHiveServer.ClientRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
@@ -176,5 +176,5 @@
     protected override dsHiveServer.ClientRow
       InsertNewRowInCache(ClientInfo client) {
-      dsHiveServer.ClientRow row = cache.NewClientRow();
+      dsHiveServer.ClientRow row = data.NewClientRow();
       row.ResourceId = client.Id;
       cache.AddClientRow(row);
@@ -184,9 +184,9 @@
 
     protected override void FillCache() {
-      cache = adapter.GetDataByActive();
+      Adapter.FillByActive(cache);
     }
 
     public override void SyncWithDb() {
-      adapter.Update(cache);
+      Adapter.Update(cache);
     }
 
@@ -197,5 +197,5 @@
     protected override IEnumerable<dsHiveServer.ClientRow>
       FindById(long id) {
-      return adapter.GetDataByResourceId(id);
+      return Adapter.GetDataByResourceId(id);
     }
 
@@ -208,5 +208,5 @@
       FindAll() {
       return FindMultipleRows(
-        new Selector(adapter.GetData),
+        new Selector(Adapter.GetData),
         new Selector(cache.AsEnumerable<dsHiveServer.ClientRow>));
     }
@@ -229,5 +229,5 @@
       return base.FindSingle(
         delegate() {
-          return adapter.GetDataById(clientId);
+          return Adapter.GetDataById(clientId);
         }, 
         delegate() {
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientGroupAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ClientGroupAdapter.cs	(revision 1131)
@@ -67,5 +67,5 @@
 
     #region Overrides
-    protected override ClientGroup Convert(dsHiveServer.ClientGroupRow row,
+    protected override ClientGroup ConvertRow(dsHiveServer.ClientGroupRow row,
       ClientGroup clientGroup) {
       if (row != null && clientGroup != null) {
@@ -129,5 +129,5 @@
     }
 
-    protected override dsHiveServer.ClientGroupRow Convert(ClientGroup clientGroup,
+    protected override dsHiveServer.ClientGroupRow ConvertObj(ClientGroup clientGroup,
       dsHiveServer.ClientGroupRow row) {
       if (clientGroup != null && row != null) {
@@ -211,5 +211,5 @@
 
       data.AddClientGroupRow(row);
-      adapter.Update(row);
+      Adapter.Update(row);
 
       return row;
@@ -218,15 +218,15 @@
     protected override void
       UpdateRow(dsHiveServer.ClientGroupRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
     protected override IEnumerable<dsHiveServer.ClientGroupRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
     protected override IEnumerable<dsHiveServer.ClientGroupRow>
       FindAll() {
-      return adapter.GetData();
+      return Adapter.GetData();
     }
     #endregion
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DBSettings.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DBSettings.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DBSettings.cs	(revision 1131)
@@ -44,5 +44,5 @@
     public static String GetConnString(String adress, String catalog, String un, String pw) {
       return "Data Source=" + adress + ";Initial Catalog=" + catalog + ";MultipleActiveResultSets=True;" +
-        "Persist Security Info=True;User ID=" + un + ";Password=" + pw;
+        "Asynchronous Processing=True;Persist Security Info=True;User ID=" + un + ";Password=" + pw;
     }
 
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/DataAdapterBase.cs	(revision 1131)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Data;
 using System.Collections.Generic;
 using System.Linq;
@@ -32,11 +33,14 @@
     where RowT : System.Data.DataRow
     where ObjT : IHiveObject, new() {
-    protected AdapterT adapter =
-      new AdapterT();
+    protected AdapterT Adapter {
+      get {
+        return new AdapterT();
+      }
+    }
 
     #region Abstract methods
-    protected abstract RowT Convert(ObjT obj, RowT row);
+    protected abstract RowT ConvertObj(ObjT obj, RowT row);
 
-    protected abstract ObjT Convert(RowT row, ObjT obj);
+    protected abstract ObjT ConvertRow(RowT row, ObjT obj);
 
     [MethodImpl(MethodImplOptions.Synchronized)]
@@ -46,8 +50,6 @@
     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
@@ -55,5 +57,17 @@
     protected delegate IEnumerable<RowT> Selector();
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
+    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 virtual RowT FindSingleRow(Selector selector) {
       RowT row = default(RowT);
@@ -73,5 +87,5 @@
       if (row != null) {
         ObjT obj = new ObjT();
-        Convert(row, obj);
+        obj = Convert(row, obj);
 
         return obj;
@@ -81,5 +95,4 @@
     }
 
-    [MethodImpl(MethodImplOptions.Synchronized)]
     protected virtual ICollection<ObjT> FindMultiple(Selector selector) {
       IEnumerable<RowT> found =
@@ -91,6 +104,7 @@
       foreach (RowT row in found) {
         ObjT obj = new ObjT();
-        Convert(row, obj);
-        result.Add(obj);
+        obj = Convert(row, obj);
+        if(obj != null)
+          result.Add(obj);
       }
 
@@ -115,5 +129,5 @@
         }
 
-        Convert(obj, row);
+        ConvertObj(obj, row);
 
         UpdateRow(row);
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobAdapter.cs	(revision 1131)
@@ -77,5 +77,5 @@
 
     #region Overrides
-    protected override Job Convert(dsHiveServer.JobRow row,
+    protected override Job ConvertRow(dsHiveServer.JobRow row,
       Job job) {
       if (row != null && job != null) {
@@ -112,5 +112,5 @@
     }
 
-    protected override dsHiveServer.JobRow Convert(Job job,
+    protected override dsHiveServer.JobRow ConvertObj(Job job,
       dsHiveServer.JobRow row) {
       if (job != null && row != null) {
@@ -147,5 +147,5 @@
 
     protected override void UpdateRow(dsHiveServer.JobRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
@@ -160,5 +160,5 @@
     protected override dsHiveServer.JobRow 
       InsertNewRowInCache(Job job) {
-      dsHiveServer.JobRow row = cache.NewJobRow();
+      dsHiveServer.JobRow row = data.NewJobRow();
       cache.AddJobRow(row);
 
@@ -167,9 +167,9 @@
 
     protected override void FillCache() {
-      adapter.FillByActive(cache);
+      Adapter.FillByActive(cache);
     }
 
     public override void SyncWithDb() { 
-      this.adapter.Update(this.cache);
+      this.Adapter.Update(cache);
     }
 
@@ -182,5 +182,5 @@
     protected override IEnumerable<dsHiveServer.JobRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
@@ -193,5 +193,5 @@
       FindAll() {
       return FindMultipleRows(
-        new Selector(adapter.GetData),
+        new Selector(Adapter.GetData),
         new Selector(cache.AsEnumerable<dsHiveServer.JobRow>));
     }
@@ -205,5 +205,5 @@
           base.FindMultiple(
             delegate() {
-              return adapter.GetDataBySubjobs(job.Id);
+              return Adapter.GetDataBySubjobs(job.Id);
             },
             delegate() {
@@ -223,5 +223,5 @@
          base.FindMultiple(
            delegate() {
-             return adapter.GetDataByState(state.ToString());
+             return Adapter.GetDataByState(state.ToString());
            },
            delegate() {
@@ -239,5 +239,5 @@
           base.FindMultiple(
             delegate() {
-              return adapter.GetDataByClient(client.Id);
+              return Adapter.GetDataByClient(client.Id);
             },
             delegate() {
@@ -258,5 +258,5 @@
           base.FindMultiple(
             delegate() {
-              return adapter.GetDataByUser(user.Id);
+              return Adapter.GetDataByUser(user.Id);
             },
             delegate() {
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobResultsAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobResultsAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobResultsAdapter.cs	(revision 1131)
@@ -40,5 +40,5 @@
 
     #region Overrides
-    protected override dsHiveServer.JobResultRow Convert(JobResult result,
+    protected override dsHiveServer.JobResultRow ConvertObj(JobResult result,
       dsHiveServer.JobResultRow row) {
       if (row != null && result != null) {
@@ -75,5 +75,5 @@
     }
 
-    protected override JobResult Convert(dsHiveServer.JobResultRow row, 
+    protected override JobResult ConvertRow(dsHiveServer.JobResultRow row, 
       JobResult result) {
       if (row != null && result != null) {
@@ -106,5 +106,5 @@
 
     protected override void UpdateRow(dsHiveServer.JobResultRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
@@ -117,9 +117,9 @@
 
     protected override IEnumerable<dsHiveServer.JobResultRow> FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
     protected override IEnumerable<dsHiveServer.JobResultRow> FindAll() {
-      return adapter.GetData();
+      return Adapter.GetData();
     }
     #endregion
@@ -140,5 +140,5 @@
           base.FindMultiple(
             delegate() {
-              return adapter.GetDataByJob(job.Id);
+              return Adapter.GetDataByJob(job.Id);
             });
       }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/PermissionOwnerAdapter.cs	(revision 1131)
@@ -42,5 +42,5 @@
 
     #region Overrides
-    protected override PermissionOwner Convert(dsHiveServer.PermissionOwnerRow row,
+    protected override PermissionOwner ConvertRow(dsHiveServer.PermissionOwnerRow row,
       PermissionOwner permOwner) {
       if (row != null && permOwner != null) {
@@ -57,5 +57,5 @@
     }
 
-    protected override dsHiveServer.PermissionOwnerRow Convert(PermissionOwner permOwner,
+    protected override dsHiveServer.PermissionOwnerRow ConvertObj(PermissionOwner permOwner,
       dsHiveServer.PermissionOwnerRow row) {
       if (row != null && permOwner != null) {
@@ -79,15 +79,15 @@
     protected override void
       UpdateRow(dsHiveServer.PermissionOwnerRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
     protected override IEnumerable<dsHiveServer.PermissionOwnerRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
     protected override IEnumerable<dsHiveServer.PermissionOwnerRow>
       FindAll() {
-      return adapter.GetData();
+      return Adapter.GetData();
     }
     #endregion
@@ -114,5 +114,5 @@
         return base.FindSingle(
           delegate() {
-            return adapter.GetDataByName(name);
+            return Adapter.GetDataByName(name);
           });
       }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ResourceAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ResourceAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/ResourceAdapter.cs	(revision 1131)
@@ -53,5 +53,5 @@
 
     #region Overrides
-    protected override Resource Convert(dsHiveServer.ResourceRow row,
+    protected override Resource ConvertRow(dsHiveServer.ResourceRow row,
       Resource resource) {
       if (row != null && resource != null) {
@@ -67,5 +67,5 @@
     }
 
-    protected override dsHiveServer.ResourceRow Convert(Resource resource,
+    protected override dsHiveServer.ResourceRow ConvertObj(Resource resource,
       dsHiveServer.ResourceRow row) {
       if (resource != null && row != null) {
@@ -78,5 +78,5 @@
 
     protected override void UpdateRow(dsHiveServer.ResourceRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
@@ -98,9 +98,9 @@
 
     protected override void FillCache() {
-      cache = adapter.GetDataByActive();
+      Adapter.FillByActive(cache);
     }
 
     public override void SyncWithDb() {
-      adapter.Update(cache);
+      Adapter.Update(cache);
     }
 
@@ -112,5 +112,5 @@
     protected override IEnumerable<dsHiveServer.ResourceRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
@@ -123,5 +123,5 @@
       FindAll() {
       return FindMultipleRows(
-        new Selector(adapter.GetData),
+        new Selector(Adapter.GetData),
         new Selector(cache.AsEnumerable<dsHiveServer.ResourceRow>));
     }
@@ -149,5 +149,5 @@
         base.FindSingleRow(
           delegate() {
-            return adapter.GetDataByName(name);
+            return Adapter.GetDataByName(name);
           },
           delegate() {
@@ -161,5 +161,5 @@
       if (row != null) {
         Resource res = new Resource();
-        Convert(row, res);
+        res = Convert(row, res);
 
         return res;
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs	(revision 1131)
@@ -75,5 +75,5 @@
 
     #region Overrides
-    protected override User Convert(dsHiveServer.HiveUserRow row,
+    protected override User ConvertRow(dsHiveServer.HiveUserRow row,
       User user) {
       if (row != null && user != null) {
@@ -93,5 +93,5 @@
     }
 
-    protected override dsHiveServer.HiveUserRow Convert(User user,
+    protected override dsHiveServer.HiveUserRow ConvertObj(User user,
       dsHiveServer.HiveUserRow row) {
       if (user != null && row != null) {
@@ -120,15 +120,15 @@
     protected override void
       UpdateRow(dsHiveServer.HiveUserRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
     protected override IEnumerable<dsHiveServer.HiveUserRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
     protected override IEnumerable<dsHiveServer.HiveUserRow>
       FindAll() {
-      return adapter.GetData();
+      return Adapter.GetData();
     }
     #endregion
@@ -149,5 +149,5 @@
         return base.FindSingle(
           delegate() {
-            return adapter.GetDataByName(name);
+            return Adapter.GetDataByName(name);
           });
       }
Index: /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs
===================================================================
--- /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs	(revision 1130)
+++ /trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/UserGroupAdapter.cs	(revision 1131)
@@ -69,5 +69,5 @@
 
     #region Overrides
-    protected override UserGroup Convert(dsHiveServer.UserGroupRow row,
+    protected override UserGroup ConvertRow(dsHiveServer.UserGroupRow row,
       UserGroup userGroup) {
       if (row != null && userGroup != null) {
@@ -130,5 +130,5 @@
     }
 
-    protected override dsHiveServer.UserGroupRow Convert(UserGroup userGroup,
+    protected override dsHiveServer.UserGroupRow ConvertObj(UserGroup userGroup,
       dsHiveServer.UserGroupRow row) {
       if (userGroup != null && row != null) {
@@ -212,5 +212,5 @@
 
       data.AddUserGroupRow(row);
-      adapter.Update(row);
+      Adapter.Update(row);
 
       return row;
@@ -219,15 +219,15 @@
     protected override void
      UpdateRow(dsHiveServer.UserGroupRow row) {
-      adapter.Update(row);
+      Adapter.Update(row);
     }
 
     protected override IEnumerable<dsHiveServer.UserGroupRow>
       FindById(long id) {
-      return adapter.GetDataById(id);
+      return Adapter.GetDataById(id);
     }
 
     protected override IEnumerable<dsHiveServer.UserGroupRow>
       FindAll() {
-      return adapter.GetData();
+      return Adapter.GetData();
     }
     #endregion
@@ -247,5 +247,5 @@
         return base.FindSingle(
           delegate() {
-            return adapter.GetDataByName(name);
+            return Adapter.GetDataByName(name);
           });
       }
