Beispiel #1
0
        /// <summary>
        /// Validates an object and returns and outputs results to debug
        /// </summary>
        public static ValidationResultSet Validate(Object o)
        {
            var context = new ValidationContext(o);
            var results = new HashSet <ValidationResult>();
            var result  = new ValidationResultSet();

            result.IsValid = Validator.TryValidateObject(o, context, result.Results, true);
            Debug.Write(LangUtilities.TextWriterToString((s) => WriteResult(s, result.Results)));
            return(result);
        }
Beispiel #2
0
 public static void WriteResultToDebug(IEnumerable <ValidationResult> results)
 {
     Debug.Write(LangUtilities.TextWriterToString((s) => WriteResult(s, results)));
 }