I am using the MVC Bind attribute as followed to include only specific fileds (properties) in MVC Model binding and it works very good:
[Bind(Include = "FirstName,LastName")]
public class MyClass
{
[Required]
public string FirstName { get; set; }
[Requiered]
public string LastName{ get; set; }
public string Discreet{ get; set; }
}
But i prefer to use it in the same way of the Required attribute instead of declare the fields i want to include at the top of the class name.
Is there an option to achieve that?
[NeverBind] doesn't work for me for some reason and in any case i prefer to specify the fields to include rather than the fields to exclude.