Enterprise Library Validation Block - Validate nullable properties?
- by Robert MacLean
I am trying to come up with a validation for a nullable property, like int?
Example
[RangeValidator(0, RangeBoundaryType.Inclusive, 1, RangeBoundaryType.Inclusive)]
int? Age { get; set; }
However if I set Age to null validation fails because it doesn't fall in the range, I know I need an [ValidatorComposition(CompositionType.Or)] as well, but what else should I use?