You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
562 B

3 weeks ago
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Wood.Util.Validations
{
/// <summary>
/// 中文验证
/// </summary>
public class ChineseOnlyAttribute : ValidationAttribute
{
public override bool IsValid(object? value)
{
if (value == null)
return false;
var str = value.ToString();
return ValidatorHelper.IsOnlyChinese(str!);
}
}
}