public DbCache(IDbCacheCore <K, T, I> core) { m_Core = core; m_Core.FlushEntities += (s, e) => Flush(); m_Index = new DbIndex <K, T>(core); m_Info = new Dictionary <K, I>(); Add(m_Core.RetrieveInitialEntities()); }
public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, bool> filter, Func <T, T, int> comparer) { m_Core = core; m_Index = index; m_Filter = filter; m_List = new SortedList <T, T>(new EntityComparer <T>(comparer)); foreach (T item in index) { if (m_Filter == null || m_Filter(item)) { lock (m_List) { m_Keys.Add(m_Core.ExtractKey(item)); InsertItem(item); } } } m_Index.IndexChanged += OnSourceIndexChanged; m_Index.IndexCleared += OnSourceIndexCleared; }
public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, T, int> comparer) : this(core, index, null, comparer) { }
public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, bool> filter) : this(core, index, filter, null) { }
public bool Remove(IDbIndex <T> item) { return(_base.Remove(item)); }
public bool Contains(IDbIndex <T> item) { return(_base.Contains(item)); }
public void Add(IDbIndex <T> item) { _base.Add(item); }