Esempio n. 1
0
        /// <summary>
        /// Indexes the simple properties.
        /// </summary>
        private void IndexSimpleProperties()
        {
            foreach (PropertyInfo propertyInfo in FetchSimpleProperties())
            {
                var csName       = GetPropertyName(propertyInfo.Name, propertyInfo);
                var ciName       = csName.ToUpper();
                var propertyType = PropertyType.SIMPLE;

                if (GenericExtensions.IsIndexedType(propertyInfo.PropertyType))
                {
                    propertyType |= PropertyType.INDEXED;
                }
                if (GenericExtensions.IsMappedType(propertyInfo.PropertyType))
                {
                    propertyType |= PropertyType.MAPPED;
                }

                var prop = new SimpleMagicPropertyInfo(
                    csName,
                    propertyInfo,
                    propertyInfo.GetGetMethod(),
                    propertyInfo.GetSetMethod(),
                    propertyType);

                AddOrUpdateProperty(csName, ciName, prop);
            }

            foreach (MethodInfo methodInfo in FetchSimpleAccessors())
            {
                var csName       = GetAccessorPropertyName(methodInfo);
                var ciName       = csName.ToUpper();
                var setter       = GetSimpleMutator(csName, methodInfo.ReturnType);
                var propertyType = PropertyType.SIMPLE;

                if (GenericExtensions.IsIndexedType(methodInfo.ReturnType))
                {
                    propertyType |= PropertyType.INDEXED;
                }
                if (GenericExtensions.IsMappedType(methodInfo.ReturnType))
                {
                    propertyType |= PropertyType.MAPPED;
                }

                var prop = new SimpleMagicPropertyInfo(
                    csName,
                    methodInfo,
                    methodInfo,
                    setter,
                    propertyType);

                AddOrUpdateProperty(csName, ciName, prop);
            }
        }