Example #1
0
        public void AddIndexer <P>(Indexer <T, P> indexer, IIndex <T, P> index)
        {
            Expression <Func <T, P> > expression = indexer.GetAccessorExpression();
            var info            = ReflectionUtils.GetPropertyFromExpression(expression);
            var indexDescriptor = new IndexDescriptor(indexer, index, typeof(T), typeof(P));

            if (this.appliedIndexes.ContainsKey(typeof(P)) == false)
            {
                this.appliedIndexes[typeof(P)] = new Dictionary <PropertyInfo, List <IndexDescriptor> >();
            }

            if (this.appliedIndexes[typeof(P)].ContainsKey(info) == false)
            {
                this.appliedIndexes[typeof(P)][info] = new List <IndexDescriptor>(1);
            }

            this.appliedIndexes[typeof(P)][info].Add(indexDescriptor);
        }
Example #2
0
        public void RemoveIndexer <P>(Indexer <T, P> indexer)
        {
            var info = ReflectionUtils.GetPropertyFromExpression(indexer.GetAccessorExpression());

            this.appliedIndexes[typeof(P)].Remove(info);
        }