示例#1
0
        public virtual IGroupColumn ReadGroupColumnAttribute(MemberInfo memberInfo)
        {
            IGroupColumn groupColumn = new GroupColumnBase();
            GroupColumnAttribute groupColumnAttribute = (GroupColumnAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(GroupColumnAttribute), true);

            if (groupColumnAttribute == null)
            {
                return null;
            }


            SetGroupColumnValue(groupColumn, memberInfo, groupColumnAttribute);


            return groupColumn;
        }
示例#2
0
        protected void SetGroupColumnValue(IGroupColumn column, MemberInfo memberInfo, GroupColumnAttribute groupColumnAttribute)
        {
            #region 不可覆盖的成员
            if (memberInfo is FieldInfo)
            {
                column.PropertyType = ((FieldInfo)memberInfo).FieldType;
            }
            else
            {
                column.PropertyType = ((PropertyInfo)memberInfo).PropertyType;
            }
            column.GroupFunction = groupColumnAttribute.GroupFunction;

            column.OriginalPropertyName = column.GroupFunction == GroupFunction.Count ? "***" : groupColumnAttribute.OriginalPropertyName;
            column.PropertyName = memberInfo.Name;
            #endregion
             
        }