Exemple #1
0
        public OperationResultException(OperationResultBase operationResult, Exception innerException)
            : base(BuildValidationIssuesMessage(operationResult), innerException)
        {
            if (operationResult == null)
            {
                throw new ArgumentNullException(nameof(operationResult));
            }

            this.OperationResult = operationResult;
        }
Exemple #2
0
        private static String BuildValidationIssuesMessage(
            OperationResultBase operationResult)
        {
            if (operationResult == null)
            {
                throw new ArgumentNullException(nameof(operationResult));
            }

            return(BuildValidationIssuesMessage(operationResult.ValidationIssues));
        }
Exemple #3
0
        public OperationResultException(ISet <ValidationIssue> validationIssues, Exception innerException)
            : base(BuildValidationIssuesMessage(validationIssues), innerException)
        {
            if (validationIssues == null)
            {
                throw new ArgumentNullException(nameof(validationIssues));
            }

            this.OperationResult = new OperationResult(validationIssues);
        }
Exemple #4
0
        public static TExecutionResult AddValidationResult <TExecutionResult>(
            this OperationResultBase <TExecutionResult> operationResult,
            ValidationResult validationResult)
            where TExecutionResult : OperationResultBase <TExecutionResult>
        {
            var memberNames = validationResult.MemberNames ?? ImmutableHashSet <String> .Empty;

            var issue = new ValidationIssue(
                message: validationResult.ErrorMessage,
                level: ValidationIssueLevel.Error,
                memberNames: memberNames.ToImmutableHashSet()
                );

            return(operationResult.AddValidationIssue(issue));
        }