I search with reflector and I didn't manage to find a case where the ValidationResult.MemberNames
is supposed to contain more than one value.
So, first of all I am wondering why MS had to do it IEnumerable<string>
, then now that they already did this, can I rely that this property will only return one value?
Update
Conserning the DataAnnotations validation system I find more sloppiness:
- The
TryValidateProperty
andTryValidateObject
should have removed the errors from the validationResults parameter if they don't exist any more. - ValidationResult should have overriden Equals and GetHashCode.
- Why is the ValidationResult.ErrorMessage mutable!? I can't event build an EqualityComparer myself!
- If the DataTypeAttribute is only used for representation concerns, why does it inherit ValidationAttribute, that's just misleading, I had to struggle till I understood (after reflectoring) that its not going to work. MS just didn't implement it.
And the list goes on.