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