Creating custom data annotation validation in MVC 3

前端 未结 4 945
说谎
说谎 2020-12-16 05:15

For instance, I have an Employee view model. When creating an employee, I want to validate the username to make sure it doesn\'t exist.

public class Employee         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 05:39

    Yes, it's possible. You'll need to write your own validation attribute.

提交回复
热议问题