Index: /trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/Agent.cs	(revision 503)
@@ -27,4 +27,5 @@
 using System.Xml;
 using HeuristicLab.CEDMA.DB.Interfaces;
+using HeuristicLab.Operators;
 
 namespace HeuristicLab.CEDMA.Core {
@@ -70,8 +71,4 @@
           newAgent.Name = entry.Name;
           newAgent.Status = entry.Status;
-          IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData);
-          newAgent.OperatorGraph.Clear();
-          foreach(IOperator op in opGraph.Operators) newAgent.OperatorGraph.AddOperator(op);
-          newAgent.OperatorGraph.InitialOperator = opGraph.InitialOperator;
           agents.Add(newAgent);
         }
@@ -87,5 +84,4 @@
           result.Summary = entry.Summary;
           result.Description = entry.Description;
-          result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData);
           results.Add(result);
         }
@@ -95,5 +91,35 @@
 
     public IView CreateView() {
+      if(OperatorGraph.Operators.Count == 0) {
+        byte[] rawData = Database.GetAgentRawData(Id);
+        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(rawData);
+        DownloadOperators(opGraph, new Dictionary<long, IOperator>());
+        foreach(IOperator op in opGraph.Operators) OperatorGraph.AddOperator(op);
+        OperatorGraph.InitialOperator = opGraph.InitialOperator;
+      }
       return new AgentView(this);
+    }
+
+    private void DownloadOperators(IOperatorGraph opGraph, Dictionary<long, IOperator> downloaded) {
+      foreach(IOperator op in opGraph.Operators) {
+        DownloadOperators(op, downloaded);
+      }
+    }
+
+    private void DownloadOperators(IOperator op, Dictionary<long, IOperator> downloaded) {
+      if(op is OperatorLink) {
+        OperatorLink link = op as OperatorLink;
+        if(downloaded.ContainsKey(link.Id)) {
+          link.Operator = downloaded[link.Id];
+        } else {
+          OperatorEntry targetEntry = Database.GetOperator(link.Id);
+          IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData);
+          downloaded.Add(link.Id, target);
+          DownloadOperators(target, downloaded);
+          link.Operator = target;
+        }
+      } else if(op is CombinedOperator) {
+        DownloadOperators(((CombinedOperator)op).OperatorGraph, downloaded);
+      }
     }
   }
Index: /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/AgentList.cs	(revision 503)
@@ -50,12 +50,4 @@
         newAgent.Name = a.Name;
         newAgent.Status = a.Status;
-        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(a.RawData);
-
-        DownloadOperators(opGraph, new Dictionary<long, IOperator>());
-
-        foreach(IOperator op in opGraph.Operators) {
-          newAgent.OperatorGraph.AddOperator(op);
-        }
-        newAgent.OperatorGraph.InitialOperator = opGraph.InitialOperator;
         agentList.Add(newAgent);
       }
@@ -86,27 +78,4 @@
     }
 
-    private void DownloadOperators(IOperatorGraph opGraph, Dictionary<long, IOperator> downloaded) {
-      foreach(IOperator op in opGraph.Operators) {
-        DownloadOperators(op, downloaded);
-      }
-    }
-
-    private void DownloadOperators(IOperator op, Dictionary<long, IOperator> downloaded) {
-      if(op is OperatorLink) {
-        OperatorLink link = op as OperatorLink;
-        if(downloaded.ContainsKey(link.Id)) {
-          link.Operator = downloaded[link.Id];
-        } else {
-          OperatorEntry targetEntry = database.GetOperator(link.Id);
-          IOperator target = (IOperator)PersistenceManager.RestoreFromGZip(targetEntry.RawData);
-          downloaded.Add(link.Id, target);
-          DownloadOperators(target, downloaded);
-          link.Operator = target;
-        }
-      } else if(op is CombinedOperator) {
-        DownloadOperators(((CombinedOperator)op).OperatorGraph, downloaded);
-      }
-    }
-
     public override IView CreateView() {
       return new AgentListView(this);
Index: /trunk/sources/HeuristicLab.CEDMA.Core/Result.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/Result.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/Result.cs	(revision 503)
@@ -53,5 +53,4 @@
           result.Summary = entry.Summary;
           result.Description = entry.Description;
-          result.Item = (IItem)PersistenceManager.RestoreFromGZip(entry.RawData);
           results.Add(result);
         }
@@ -61,4 +60,8 @@
 
     public IView CreateView() {
+      if(Item == null) {
+        byte[] rawData = Database.GetResultRawData(Id);
+        Item = (IItem)PersistenceManager.RestoreFromGZip(rawData);
+      }
       return Item.CreateView();
     }
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/AgentEntry.cs	(revision 503)
@@ -40,6 +40,4 @@
     [DataMember]
     public ProcessStatus Status { get; set; }
-    [DataMember]
-    public byte[] RawData { get; set; }
   }
 }
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/IDatabase.cs	(revision 503)
@@ -65,8 +65,14 @@
 
     [OperationContract]
+    byte[] GetAgentRawData(long id);
+
+    [OperationContract]
     ICollection<ResultEntry> GetResults(long agentId);
 
     [OperationContract]
     ICollection<ResultEntry> GetSubResults(long parentResultId);
+
+    [OperationContract]
+    byte[] GetResultRawData(long id);
 
     [OperationContract]
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/ResultEntry.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/ResultEntry.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/ResultEntry.cs	(revision 503)
@@ -42,6 +42,4 @@
     [DataMember]
     public DateTime CreationTime { get; set; }
-    [DataMember]
-    public byte[] RawData { get; set; }
   }
 }
Index: /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.DB/Database.cs	(revision 503)
@@ -354,5 +354,5 @@
           cnn.Open();
           SQLiteCommand c = cnn.CreateCommand();
-          c.CommandText = "Select id, name, rawdata from Agent where Status=@Status";
+          c.CommandText = "Select id, name from Agent where Status=@Status";
           DbParameter statusParameter = c.CreateParameter();
           statusParameter.ParameterName = "@Status";
@@ -366,5 +366,4 @@
             agent.Id = r.GetInt32(0);
             agent.Name = r.IsDBNull(1) ? "" : r.GetString(1);
-            agent.RawData = (byte[])r.GetValue(2);
             agents.Add(agent);
           }
@@ -383,5 +382,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select id, name, status, rawdata from Agent where ParentAgentId isnull";
+            c.CommandText = "Select id, name, status from Agent where ParentAgentId isnull";
             using(DbDataReader r = c.ExecuteReader()) {
               while(r.Read()) {
@@ -391,5 +390,4 @@
                 agent.Name = r.IsDBNull(1) ? "-" : r.GetString(1);
                 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2));
-                agent.RawData = (byte[])r.GetValue(3);
                 agents.Add(agent);
               }
@@ -410,5 +408,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select id, name, status, rawdata from Agent where ParentAgentId=@ParentAgentId";
+            c.CommandText = "Select id, name, status from Agent where ParentAgentId=@ParentAgentId";
             DbParameter parentParameter = c.CreateParameter();
             parentParameter.ParameterName = "@ParentAgentId";
@@ -423,5 +421,4 @@
                 agent.Name = r.IsDBNull(1) ? "-" : r.GetString(1);
                 agent.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(2));
-                agent.RawData = (byte[])r.GetValue(3);
                 agents.Add(agent);
               }
@@ -435,4 +432,29 @@
     }
 
+    public byte[] GetAgentRawData(long id) {
+      rwLock.EnterReadLock();
+      try {
+        using(DbConnection cnn = new SQLiteConnection(connectionString)) {
+          cnn.Open();
+          using(DbCommand c = cnn.CreateCommand()) {
+            c.CommandText = "Select RawData from Agent where Id=@Id";
+            DbParameter idParameter = c.CreateParameter();
+            idParameter.ParameterName = "@Id";
+            idParameter.Value = id;
+            c.Parameters.Add(idParameter);
+            using(DbDataReader r = c.ExecuteReader()) {
+              if(r.HasRows) {
+                r.Read();
+                return (byte[])r.GetValue(0);
+              }
+            }
+          }
+        }
+      } finally {
+        rwLock.ExitReadLock();
+      }
+      return null; // agent with the given id not found
+    }
+
     public ICollection<ResultEntry> GetResults(long agentId) {
       List<ResultEntry> results = new List<ResultEntry>();
@@ -442,5 +464,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select Id, CreationTime, Summary, Description, Rawdata from Result where AgentId=@AgentId";
+            c.CommandText = "Select Id, CreationTime, Summary, Description from Result where AgentId=@AgentId";
             DbParameter agentParam = c.CreateParameter();
             agentParam.ParameterName = "@AgentId";
@@ -455,5 +477,4 @@
                 result.Summary = r.GetString(2);
                 result.Description = r.GetString(3);
-                result.RawData = (byte[])r.GetValue(4);
                 results.Add(result);
               }
@@ -474,5 +495,5 @@
           cnn.Open();
           using(DbCommand c = cnn.CreateCommand()) {
-            c.CommandText = "Select Id, CreationTime, Summary, Description, Rawdata from Result where ParentResultId=@ParentResultId";
+            c.CommandText = "Select Id, CreationTime, Summary, Description from Result where ParentResultId=@ParentResultId";
             DbParameter parentParam = c.CreateParameter();
             parentParam.ParameterName = "@ParentResultId";
@@ -487,5 +508,4 @@
                 result.Summary = r.GetString(2);
                 result.Description = r.GetString(3);
-                result.RawData = (byte[])r.GetValue(4);
                 results.Add(result);
               }
@@ -497,4 +517,29 @@
       }
       return results;
+    }
+
+    public byte[] GetResultRawData(long id) {
+      rwLock.EnterReadLock();
+      try {
+        using(DbConnection cnn = new SQLiteConnection(connectionString)) {
+          cnn.Open();
+          using(DbCommand c = cnn.CreateCommand()) {
+            c.CommandText = "Select RawData from Result where Id=@Id";
+            DbParameter idParameter = c.CreateParameter();
+            idParameter.ParameterName = "@Id";
+            idParameter.Value = id;
+            c.Parameters.Add(idParameter);
+            using(DbDataReader r = c.ExecuteReader()) {
+              if(r.HasRows) {
+                r.Read();
+                return (byte[])r.GetValue(0);
+              }
+            }
+          }
+        }
+      } finally {
+        rwLock.ExitReadLock();
+      }
+      return null; // result with the given id not found
     }
 
Index: /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs	(revision 502)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/RunScheduler.cs	(revision 503)
@@ -74,5 +74,7 @@
         scope.AddVariable(new Variable("AgentId", new IntData((int)entry.Id)));
         scope.AddVariable(new Variable("CedmaServerUri", new StringData(serverUri)));
-        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(entry.RawData);
+
+        byte[] rawData = database.GetAgentRawData(entry.Id);
+        IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(rawData);
 
         PatchLinks(opGraph, new Dictionary<long, IOperator>());
