示例#1
0
 private static IEnumerable <ModelClientValidationRule> GetRulesFromAttributes(PropertyVm property)
 {
     return(property.GetCustomAttributes()
            .SelectMany(attribute => UnobtrusiveValidationAttributeRules,
                        (attribute, rule) => rule(property, attribute))
            .Where(r => r != null));
 }
示例#2
0
 public static bool HasAttribute <TAtt>(this PropertyVm propertyVm)
 {
     return(propertyVm.GetCustomAttributes().OfType <TAtt>().Any());
 }
示例#3
0
        public static IHtmlString Placeholder(PropertyVm pi)
        {
            var placeHolderText = pi.GetCustomAttributes().OfType <DisplayAttribute>().Select(a => a.Prompt).FirstOrDefault();

            return(Attr((!string.IsNullOrWhiteSpace(placeHolderText)), "placeholder", placeHolderText));
        }