Last active
December 15, 2015 01:39
-
-
Save brainded/5182061 to your computer and use it in GitHub Desktop.
Run Validator Manually on DataAnnotations. Useful when using DataAnnotations in a Non MVC Context, like a console application or a service.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var objectToValidate = new ObjectToValidate(); | |
var context = new ValidationContext(goUpgradesStandbyProductRequestData, null, null); | |
var results = new List<ValidationResult>(); | |
bool isValid = Validator.TryValidateObject(objectToValidate, context, results, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment