Creating a custom validation through DataAnnotations?

后端 未结 2 1709
一整个雨季
一整个雨季 2021-01-22 14:19

Ok so when I want to have a property be validated, I might write something like this:

    [Required]
    [StringLength(255)]
    [DataType(DataType.EmailAddress)         


        
2条回答
  •  [愿得一人]
    2021-01-22 14:48

    The documentation for ValidationAttribute shows how to create your custom validation attribute.

提交回复
热议问题