Ejemplo n.º 1
0
        public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
        {
            if ((bindingAttr & BindingFlags.Public) != BindingFlags.Public)
            {
                return(new PropertyInfo[0]);
            }
            var propertyInfos = _filterPredicate != null?propertiesCore.Where(_filterPredicate) : propertiesCore;

            return(propertyInfos.Select(info => {
                Type propertyType = GetPropertyType(info);
                if (propertyType.IsValueType)
                {
                    propertyType = typeof(Nullable <>).MakeGenericType(new[] { propertyType });
                }
                var simplePropertyInfo = new XpandPropertyInfo(info.Name, propertyType, GetType(), info.CanRead, info.CanWrite);
                if (_category != null)
                {
                    simplePropertyInfo.AddAttribute(new CategoryAttribute(_category));
                }
                return simplePropertyInfo;
            }).OfType <PropertyInfo>().ToArray());
        }
Ejemplo n.º 2
0
 public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) {
     if ((bindingAttr & BindingFlags.Public) != BindingFlags.Public) return new PropertyInfo[0];
     var propertyInfos = _filterPredicate != null ? propertiesCore.Where(_filterPredicate) : propertiesCore;
     var simplePropertyInfos = propertyInfos.Select(info => {
         Type propertyType = GetPropertyType(info);
         if (propertyType.IsValueType) {
             propertyType = typeof(Nullable<>).MakeGenericType(new[] { propertyType });
         }
         var simplePropertyInfo = new XpandPropertyInfo(info.Name, propertyType, GetType(), info.CanRead, info.CanWrite);
         if (_category != null) simplePropertyInfo.AddAttribute(new CategoryAttribute(_category));
         return simplePropertyInfo;
     });
     return simplePropertyInfos.ToArray();
 }