Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will the ValidationResult.MemberNames property ever contain more than one value?

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
Concerning 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.

like image 402
Shimmy Weitzhandler Avatar asked Nov 16 '25 08:11

Shimmy Weitzhandler


1 Answers

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

like image 189
Jeff Handley Avatar answered Nov 17 '25 20:11

Jeff Handley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!