Multiple Validators on a Single Parameter

Topics: Policy Injection Application Block, Validation Application Block
Oct 19, 2007 at 4:36 PM
Edited Oct 19, 2007 at 4:40 PM
I am using the PIAB and VAB to validate a parameter to a method. In particular, I want the value of the Int64? parameter to be null or non-negative. However, neither this:

[ValidationCallHandler]
public void DoThis([ValidatorComposition(CompositionType.Or)]
[NotNullValidator(Negated=true)]
[RangeValidator(typeof(Int64), "0", RangeBoundaryType.Inclusive, "0", RangeBoundaryType.Ignore)] Int64? number)

nor this:

[ValidationCallHandler]
public void DoThis([IgnoreNulls]
[RangeValidator(typeof(Int64), "0", RangeBoundaryType.Inclusive, "0", RangeBoundaryType.Ignore)] Int64? number)

give me what I want. The validators work properly when used by themselves, but when I try to combine more than one, the validation does not work as I expect.

Any insight would be greatly appreciated.