【发布时间】:2022-03-08 16:54:02
【问题描述】:
hello fluent 验证已更新至 10.3.6 版,但之前在properyvalidator 中工作的 SetMessage 函数不再工作,我应该改用什么?
public class TcknOrVknPropValidator : PropertyValidator
{
public TcknOrVknPropValidator() : base()
{
}
protected override bool IsValid(PropertyValidatorContext context)
{
var propertyValue = context.PropertyValue as string;
if (string.IsNullOrWhiteSpace(propertyValue))
{
SetErrorMessage("Tc veya Vergi No Geçersiz");//this function not found now
return false;
}
if (propertyValue.Length < 10 || propertyValue.Length > 11)
{
SetErrorMessage("Tc Veya Vergi No Eksik Yada Hatalı");
return false;
}
return true;
}
【问题讨论】:
标签: asp.net-core asp.net-core-mvc fluentvalidation