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

New Post: Validate a List of objects

$
0
0
Let's say I have an object, MyEntity, and a Validator for it, MyEntityValidator : AbstractValidator<MyEntity>. Now, I have incoming a List<MyEntity>, and I want to validate all the MyEntitys in this list. What is the correct way of doing this validation? I obviously can't use MyEntityValidator, since it expects a MyEntity and not a List<MyEntity>, but creating MyEntityListValidator : AbstractValidator<IEnumerable<MyEntity>> seems like overkill (and I'm not sure how that would work anyway). Creating a new class, ListOfMyEntities, also seems like overkill.

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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