Ejemplo n.º 1
0
            internal override IDictionary <string, ReflectionUtils.GetDelegate> GetterValueFactory(Type type)
            {
                var result = new Dictionary <string, ReflectionUtils.GetDelegate>();

                foreach (var propertyInfo in GetProperties(type, prop => prop.CanRead))
                {
                    result[_namingScheme.GetName(propertyInfo)] = GetGetter(ReflectionUtils.GetGetMethod(propertyInfo), propertyInfo, propertyInfo.PropertyType);
                }
                foreach (var fieldInfo in GetFields(type))
                {
                    result[_namingScheme.GetName(fieldInfo)] = GetGetter(ReflectionUtils.GetGetMethod(fieldInfo), fieldInfo, fieldInfo.FieldType);
                }

                return(result);
            }
Ejemplo n.º 2
0
        protected override Expression VisitMemberExpression(MemberExpression expression)
        {
            if (expression.Member is PropertyInfo || expression.Member is FieldInfo)
            {
                if (_selectMode && _parts.Count == 0 && ContentHelper.IsObject(expression.Type))
                {
                    _parts.Add("*");
                }
                _parts.Add(_namingScheme.GetName(expression.Member));
                return(BaseVisitMemberExpression(expression));
            }

            return(base.VisitMemberExpression(expression));
        }