Changeset 1026


Ignore:
Timestamp:
12/18/08 14:37:37 (12 years ago)
Author:
svonolfe
Message:

fixed caching (#372)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/CachedDataAdapter.cs

    r1021 r1026  
    2626using HeuristicLab.Hive.Contracts.BusinessObjects;
    2727using System.Runtime.CompilerServices;
     28using System.Data;
    2829
    2930namespace HeuristicLab.Hive.Server.ADODataAccess {
     
    3738    protected CacheT cache =
    3839      new CacheT();
     40
     41    protected IDictionary<RowT, DataTable> parentTable =
     42      new Dictionary<RowT, DataTable>();
    3943
    4044    protected ICollection<ICachedDataAdapter> parentAdapters =
     
    128132
    129133    protected virtual void RemoveRowFromCache(RowT row) {
     134      if (parentTable.ContainsKey(row)) {
     135        parentTable[row].Rows.Add(row);
     136        parentTable.Remove(row);
     137      }
     138     
    130139      cache.Rows.Remove(row);
    131140    }
     
    169178            !PutInCache(obj)) {
    170179          //remove from cache
     180          RemoveRowFromCache(row);
    171181          UpdateRow(row);
    172           RemoveRowFromCache(row);
    173182        } else if (!IsCached(row) &&
    174183          PutInCache(obj)) {
    175184          //add to cache
     185          if (row.Table != null) {
     186            parentTable[row] = row.Table;
     187            row.Table.Rows.Remove(row);
     188          }
    176189          cache.Rows.Add(row);
    177190        }
Note: See TracChangeset for help on using the changeset viewer.