Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 770 Bytes

File metadata and controls

23 lines (13 loc) · 770 Bytes

DataAnnotationsValidatorRecursive

The helper will recursively traverse your object graph and invoke validation against DataAnnotations. This originated from following Stackoverflow answer: http://stackoverflow.com/a/8090614/605586

This fork is for multi target support of .net standard and .net framework

Installation

Available as NuGet-Package dataannotationsvalidator:

Install-Package dataannotationsvalidator

Usage

See file DataAnnotationsValidator/DataAnnotationsValidator.Tests/DataAnnotationsValidatorTests.cs

Short example:

var validator = new DataAnnotationsValidator.DataAnnotationsValidator();
var validationResults = new List<ValidationResult>();

validator.TryValidateObjectRecursive(modelToValidate, validationResults);