views:

26

answers:

1

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:

  1. The TryValidateProperty and TryValidateObject should have removed the errors from the validationResults parameter if they don't exist any more.
  2. ValidationResult should have overriden Equals and GetHashCode.
  3. Why is the ValidationResult.ErrorMessage mutable!? I can't event build an EqualityComparer myself!
  4. 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.

A: 

Consider Password and PasswordConfirmation. Or any Start/Stop values, or any other cross-field validation.

Jeff Handley
I see. it's still a bit foolish, look at my other aspects.
Shimmy