DataAnnotations “NotRequired” attribute
问题 I've a model kind of complicated. I have my UserViewModel which has several properties and two of them are HomePhone and WorkPhone . Both of type PhoneViewModel . In PhoneViewModel I have CountryCode , AreaCode and Number all strings. I want to make the CountryCode optional but AreaCode and Number mandatory. This works great. My problem is that in the UserViewModel WorkPhone is mandatory, and HomePhone is not. Is there anyway I can dissable Require attributs in PhoneViewModel by setting any