Beispiel #1
0
        /// <summary>
        ///     添加描述
        /// </summary>
        /// <param name="expression">属性表达式,范例:t => t.Name</param>
        protected void AddDescription <TProperty>(Expression <Func <T, TProperty> > expression)
        {
            var member      = Lambda.GetMember(expression);
            var description = Reflection.GetDisplayNameOrDescription(member);
            var value       = member.GetPropertyValue(this);

            if (Reflection.IsBool(member))
            {
                value = Convert.ToBool(value).Description();
            }

            AddDescription(description, value);
        }
 /// <summary>
 ///     转换为bool
 /// </summary>
 /// <param name="obj">数据</param>
 public static bool ToBool(this string obj)
 {
     return(Convert.ToBool(obj));
 }