1

这就是我要找的:

[RequiredIf("IsNewClient", true, ErrorMessage =*The value of other (string) property*)]

那会更好:

[RequiredIf("IsNewClient", true, ErrorMessage =*Calling a function and get the value*)]
4

1 回答 1

1

您可以使用类似的方法:

[RequiredIf("GoAbroad == true")]
public string PassportNumber { get; set; }

有关更多信息,请查看ExpressiveAnnotations。希望这可以帮助...

于 2017-03-10T15:05:45.020 回答