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

New Post: Re-using Validators for Complex Properties cannot specify WithMessage

$
0
0

When I set a validator on a complex property the message I set in the parent validator is ignored:

 

RuleFor(issuer => issuer.Location)
  .SetValidator(new LocationValidator())
  .WithMessage("Wrong Location for issuer: {0}", issuer => issuer.IssuerId);

I want to specify the message in the parent validator because I need to specify the IssuerId.


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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