예제 #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;
        }
예제 #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));
 }
예제 #3
0
 public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, bool> filter)
     : this(core, index, filter, null)
 {
 }
예제 #4
0
 public DbView(IDbIndexCore <K, T> core, IDbIndex <K, T> index, Func <T, T, int> comparer)
     : this(core, index, null, comparer)
 {
 }
예제 #5
0
 public DbIndex(IDbIndexCore <K, T> core)
 {
     m_Core = core;
 }