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

New Post: Do validation only for a single property

$
0
0

No.

After some re-thinking, this does not solve my problem.

I want to validate the value ("MyCode") from the Code property form the Product class. The way you explain is that when I do a new Product(), the Code field is set to null, so validation will always fail.

What I should do is varresult =validator.Validate(newProduct { Code = "MyCode"},x =>x.Code);  But I want generic code to do this.


Viewing all articles
Browse latest Browse all 1917

Trending Articles



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