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 static IDbIndex <K, T> CreateIndex <K, T>(IDbIndexCore <K, T> core) where T : class, IDbEntity <T> { return(new DbIndex <K, T>(core)); }
public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, bool> filter) : this(core, index, filter, null) { }
public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, T, int> comparer) : this(core, index, null, comparer) { }
public DbIndex(IDbIndexCore <K, T> core) { m_Core = core; }