5
public static ValidationResult NumberOfItems(int numItems, ValidationContext pValidationContext)
{
if (numItems == 1)
{
//Tag as critical error
//return new ValidationResult...
}
if (numItems > 1 && numItems <= 10)
{
//Tag as non critical error
}
//Else it's successful
return ValidationResult.Success;
}
나는 심각한 오류 여부 같은 오류 메시지에 태그를하고 싶습니다. 중요한 오류가 아니라면 내보기에서 액세스하고 다른 방식으로 렌더링하고 싶습니다. 사용자 정의 유효성 검사기
은 어떻게 할 것이 중요한 오류를 식별하기 위해 기본 ModelBinder를 수정의 다른 유형과 같은
- 태그 실패 :
그래서,이 2 개 부분이있다 이?
데이터 주석을 사용하지 않고 다른 유효성 확인 프레임 워크로 이동하면 어떻게됩니까? –
@Dave Schilling 그러면 다른 질문을해야합니다. ;) – jfar