Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Commented Unassigned: Pass validation instance along .SetValidator() [7157]

$
0
0
Good evening,

What I am missing with the current .SetValidator(..) implementations is a way to pass along / work with the validation context's instance of T - is there any way to do this? E.g. that sub-validator might require information/data from the parent object of the property passed along for validation
Comments: Hi Jeremy, What if I am already using a custom validator like this: __public class ValidatePassportExpiryValidator : PropertyValidator, IHasClientValidator {}__ which I just pass to my Rule like this: __RuleFor(x=> x.StringPassportExpiryDate) .SetValidator(new ValidatePassportExpiryValidator()).WithLocalizedMessage(() => Step2.InvalidPassportExpiryDate);__ Currently it doesn't allow me to pass anything to my validator class Can you please help. Thanks in advance.

Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>