Exemplo n.º 1
0
        /// <summary>Creates an exception.</summary>
        ///
        /// <param name="errorCode">   The error code.</param>
        /// <param name="errorMessage">Message describing the error.</param>
        /// <param name="fieldName">   Name of the field.</param>
        ///
        /// <returns>The new exception.</returns>
        public static ValidationError CreateException(string errorCode, string errorMessage, string fieldName)
        {
            var error = new ValidationErrorField(errorCode, fieldName, errorMessage);

            return(new ValidationError(new ValidationErrorResult(new List <ValidationErrorField> {
                error
            })));
        }
Exemplo n.º 2
0
 /// <summary>Initializes a new instance of the NServiceKit.Validation.ValidationError class.</summary>
 ///
 /// <param name="validationError">The validation error.</param>
 public ValidationError(ValidationErrorField validationError)
     : this(validationError.ErrorCode, validationError.ErrorMessage)
 {
     this.Violations.Add(validationError);
 }
Exemplo n.º 3
0
 /// <summary>Creates an exception.</summary>
 ///
 /// <param name="error">The error.</param>
 ///
 /// <returns>The new exception.</returns>
 public static ValidationError CreateException(ValidationErrorField error)
 {
     return new ValidationError(error);
 }
Exemplo n.º 4
0
 /// <summary>Creates an exception.</summary>
 ///
 /// <param name="errorCode">   The error code.</param>
 /// <param name="errorMessage">Message describing the error.</param>
 /// <param name="fieldName">   Name of the field.</param>
 ///
 /// <returns>The new exception.</returns>
 public static ValidationError CreateException(string errorCode, string errorMessage, string fieldName)
 {
     var error = new ValidationErrorField(errorCode, fieldName, errorMessage);
     return new ValidationError(new ValidationErrorResult(new List<ValidationErrorField> { error }));
 }
Exemplo n.º 5
0
 /// <summary>Initializes a new instance of the NServiceKit.Validation.ValidationError class.</summary>
 ///
 /// <param name="validationError">The validation error.</param>
 public ValidationError(ValidationErrorField validationError)
     : this(validationError.ErrorCode, validationError.ErrorMessage)
 {
     this.Violations.Add(validationError);
 }
Exemplo n.º 6
0
 /// <summary>Creates an exception.</summary>
 ///
 /// <param name="error">The error.</param>
 ///
 /// <returns>The new exception.</returns>
 public static ValidationError CreateException(ValidationErrorField error)
 {
     return(new ValidationError(error));
 }