<commit_before>﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HermaFx.DataAnnotations
{
	public class AggregateValidationException : ValidationException
	{
		private const string DefaultErrorMessage = "Object of type {0} has some invalid values.";

		public IEnumerable<ValidationException> ValidationExceptions { get; private set; }

		public AggregateValidationException(string errorMessage, IEnumerable<ValidationException> exceptions)
			: base(AggregateResultsFrom(errorMessage, exceptions), null, null)
		{
			ValidationExceptions = exceptions.ToArray();
		}

		public AggregateValidationException(string errorMessage, AggregateValidationResult validationResult)
			: base(validationResult, null, null)
		{
			ValidationExceptions = validationResult.Flatten().Select(x => new ValidationException(x.ErrorMessage));
		}

		#region Helper Methods<commit_msg>Added a new ValidationResults property<commit_after>﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HermaFx.DataAnnotations
{
	public class AggregateValidationException : ValidationException
	{
		private const string DefaultErrorMessage = "Object of type {0} has some invalid values.";

		public IEnumerable<ValidationResult> ValidationResults { get; private set; }
		public IEnumerable<ValidationException> ValidationExceptions { get; private set; }

		public AggregateValidationException(string errorMessage, IEnumerable<ValidationException> exceptions)
			: base(AggregateResultsFrom(errorMessage, exceptions), null, null)
		{
			ValidationResults = (base.ValidationResult as AggregateValidationResult).Results;
			ValidationExceptions = exceptions.ToArray();
		}

		public AggregateValidationException(string errorMessage, AggregateValidationResult validationResult)
			: base(validationResult, null, null)
		{
			ValidationResults = validationResult.Results;
			ValidationExceptions = validationResult.Flatten().Select(x => new ValidationException(x.ErrorMessage));
		}

		#region Helper Methods
{'fraction_non_alphanumeric': 0.07820976491862568, 'fraction_numerical': 0.0009041591320072332, 'mean_word_length': 6.7377622377622375, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551319', 'n_tokens_mistral': 602, 'n_tokens_neox': 552, 'n_words': 139}