How to disable the [Required]
attribute that has been set on a model property.
I tried with below code using new
keyword but not working.
I also tried override
keyword as well not worked.
ChildModel
uses most of the properties of BaseModel
that's instead of create new model file and code many similar properties I'm thinking to do something like this.
public class BaseModel
{
[Required]
public string Address{ get; set; }
}
public class ChildModel : BaseModel
{
public new string Address{ get; set; }
}
Any simple solution ?