// Copied from DataAnnotationsModelBinder because it was internal and I needed to override OnPropertyValidating above protected static IEnumerable<ValidationAttribute> GetValidationAttributes(PropertyDescriptor propertyDescriptor) { IEnumerable<ValidationAttribute> attributes = propertyDescriptor.GetAttributes<ValidationAttribute>(); // Add an implied RequiredAttribute to non-nullable types if it's not already there if (!propertyDescriptor.PropertyType.IsNullable()) { if (!attributes.Any(attr => attr is iServe.Models.dotNailsCommon.RequiredAttribute)) { attributes = attributes.Concat(new[] { new iServe.Models.dotNailsCommon.RequiredAttribute() }); } } return attributes; }