【发布时间】:2013-12-17 18:52:11
【问题描述】:
我只想把 conditionalRequired Attribute 这与 WEB API
一起使用示例
public sealed class EmployeeModel
{
[Required]
public int CategoryId{ get; set; }
public string Email{ get; set; } // If CategoryId == 1 then it is required
}
我正在通过 (ActionFilterAttribute)
使用模型状态验证【问题讨论】:
标签: c# asp.net-mvc-4 asp.net-web-api custom-attributes