public static IRuleBuilderOptions <T, TProperty> CustomFault <T, TProperty>(this IRuleBuilderOptions <T, TProperty> rule, CustomFaultCode errorCode, string errorMessage)
 {
     return(rule.WithMessage(errorMessage).WithErrorCode(ErrorType.CustomError.ToString() + "###" + errorCode.Name));
 }
Example #2
0
 public static void AddCustomFault(this CustomContext context, string property, CustomFaultCode errorCode, string errorMessage)
 {
     context.AddFailure(new ValidationFailure(property, errorMessage)
     {
         ErrorCode = ErrorType.CustomError.ToString() + "###" + errorCode.Name
     });
 }