平安校园
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.
 
 
 
 
 
 

25 lines
517 B

  1. namespace SafeCampus.Core;
  2. /// <summary>
  3. /// 验证Id不能为 空
  4. /// </summary>
  5. public class IdNotNull : ValidationAttribute
  6. {
  7. public override bool IsValid(object value)
  8. {
  9. return value != null && (value.ToLong() > 0 || !string.IsNullOrEmpty(value.ToString()));
  10. }
  11. }
  12. /// <summary>
  13. /// 验证Id列表不能为空
  14. /// </summary>
  15. public class IdsNotNull : ValidationAttribute
  16. {
  17. public override bool IsValid(object value)
  18. {
  19. return value is not List<string> { Count: 0 };
  20. }
  21. }