コード例 #1
0
 public Index(string indexField, IndexableAttribute indexAttribute)
 {
     _indexField     = indexField;
     _theProp        = typeof(T).GetProperty(_indexField);
     _indexAttribute = indexAttribute;
     if (_indexAttribute.IndexMode == IndexModeEnum.IndexModeAlways)
     {
         _loaded = true;
     }
 }
        public BalancedTreeIndex(string indexField, IndexableAttribute indexAttribute)
        {
            _indexField     = indexField;
            _theProp        = typeof(T).GetProperty(_indexField);
            _indexAttribute = indexAttribute;
            var propType = _theProp.PropertyType;
            var propInfo = typeof(T).GetProperty(indexField);

            var classTypeWrapper       = Type.GetType("Csla.Linq.RedBlackTreeWrapper`2");
            var typeParamsWrapper      = new Type[] { propType, typeof(T) };
            var constructedTypeWrapper = classTypeWrapper.MakeGenericType(typeParamsWrapper);
            var ctorParamsWrapper      = new object[] { propInfo };

            _index = Activator.CreateInstance(constructedTypeWrapper, ctorParamsWrapper);


            if (_indexAttribute.IndexMode == IndexModeEnum.IndexModeAlways)
            {
                _loaded = true;
            }
        }